Skip to content

Commit f45ce48

Browse files
committed
check valid PMEM memory using pmem_is_pmem
1 parent ed2ed06 commit f45ce48

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

build_mysql.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ IS_DEBUG=0
1111
#BUILD_NAME="-DUNIV_PMEMOBJ_WAL -DUNIV_TRACE_FLUSH_TIME"
1212
#BUILD_NAME="-DUNIV_PMEMOBJ_WAL -DUNIV_PMEMOBJ_WAL_ELR -DUNIV_TRACE_FLUSH_TIME"
1313
#BUILD_NAME="-DUNIV_NVM_LOG -DUNIV_PMEMOBJ_WAL -DUNIV_TRACE_FLUSH_TIME"
14-
#BUILD_NAME="-DUNIV_PMEMOBJ_PERSIST -DUNIV_PMEMOBJ_PPL_STAT -DUNIV_PMEMOBJ_PAGE_LOG -DUNIV_PMEMOBJ_PART_PL -DUNIV_PMEMOBJ_PL -DUNIV_TRACE_RECOVERY_TIME" #benchmark
14+
BUILD_NAME="-DUNIV_PMEMOBJ_PERSIST -DUNIV_PMEMOBJ_PPL_STAT -DUNIV_PMEMOBJ_PAGE_LOG -DUNIV_PMEMOBJ_PART_PL -DUNIV_PMEMOBJ_PL -DUNIV_TRACE_RECOVERY_TIME" #benchmark
1515
#BUILD_NAME="-DUNIV_PMEMOBJ_PERSIST -DUNIV_PMEMOBJ_PPL_STAT -DUNIV_PMEMOBJ_PAGE_LOG -DUNIV_PMEMOBJ_PART_PL -DUNIV_PMEMOBJ_PART_PL_DEBUG -DUNIV_PMEMOBJ_PL -DUNIV_TRACE_FLUSH_TIME"
1616
#######################################
1717

@@ -89,7 +89,7 @@ IS_DEBUG=0
8989
## EVEN + BLOOM
9090
#BUILD_NAME="-DUNIV_OPENMP -DUNIV_PMEMOBJ_BLOOM -DUNIV_PMEMOBJ_BUF -DUNIV_PMEMOBJ_BUF_FLUSHER -DUNIV_PMEMOBJ_BUF_RECOVERY -DUNIV_PMEMOBJ_BUF_STAT -DUNIV_TRACE_FLUSH_TIME"
9191
## LESS + BLOOM
92-
BUILD_NAME="-DUNIV_OPENMP -DUNIV_PMEMOBJ_BLOOM -DUNIV_PMEMOBJ_BUF -DUNIV_PMEMOBJ_BUF_PARTITION -DUNIV_PMEMOBJ_BUF_FLUSHER -DUNIV_PMEMOBJ_BUF_RECOVERY"
92+
#BUILD_NAME="-DUNIV_OPENMP -DUNIV_PMEMOBJ_BLOOM -DUNIV_PMEMOBJ_BUF -DUNIV_PMEMOBJ_BUF_PARTITION -DUNIV_PMEMOBJ_BUF_FLUSHER -DUNIV_PMEMOBJ_BUF_RECOVERY"
9393
#BUILD_NAME="-DUNIV_OPENMP -DUNIV_PMEMOBJ_BLOOM -DUNIV_PMEMOBJ_BUF -DUNIV_PMEMOBJ_BUF_PARTITION -DUNIV_PMEMOBJ_BUF_FLUSHER -DUNIV_PMEMOBJ_BUF_RECOVERY -DUNIV_PMEMOBJ_BUF_STAT -DUNIV_TRACE_FLUSH_TIME" # Paper writing
9494

9595
#LSB

storage/innobase/pmem/pmem0log.cc

+8
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "os0file.h"
2626

2727
#if defined (UNIV_PMEMOBJ_PL)
28+
#include <libpmem.h>
2829

2930
#if defined (UNIV_PMEMOBJ_PL)
3031
//static FILE* debug_ptxl_file = fopen("pll_debug.txt","a");
@@ -160,6 +161,13 @@ pm_wrapper_page_log_alloc_or_open(
160161
printf("Total NVDIMM allocated = \t\t %f (MB)\n", (pmw->ppl->pmem_alloc_size * 1.0)/ (1024*1024));
161162
float log_file_size_MB = PMEM_LOG_FILE_SIZE * 4 * 1024 * 1.0 / (1024 * 1024);
162163
printf("Log files %zu x %f (MB) = \t %f (MB)\n", PMEM_N_LOG_BUCKETS, log_file_size_MB, (PMEM_N_LOG_BUCKETS * log_file_size_MB));
164+
165+
/*Test PMEM memory, we should ensure the allocated memory is persistent*/
166+
/*pmem_is_pmem() require libpmem.h*/
167+
bool is_pmem = pmem_is_pmem(pmw->ppl->p_align, pmw->ppl->pmem_alloc_size);
168+
unsigned char* end_addr = pmw->ppl->p_align + pmw->ppl->pmem_alloc_size;
169+
printf("Memory address from %zu to %zu isPMEM = %d \n", pmw->ppl->p_align, end_addr, is_pmem);
170+
163171
printf(" =================================\n");
164172

165173
}

storage/innobase/pmem/pmem0wrapper.cc

+11
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ PMEM_WRAPPER* pm_wrapper_create(const char* path, const size_t pool_size){
4343
fprintf(stderr, "PMEM_ERROR: checking version fail: %s \n", pmemobj_errormsg());
4444
}
4545

46+
/*Further checks */
47+
int flush;
48+
char *e = getenv("PMEM_NO_FLUSH");
49+
printf("[PMEM_INFO] getenv PMEM_NO_FLUSH return %s\n", e);
50+
if (e && (strcmp(e, "1") == 0)) {
51+
flush = 0;
52+
printf("Forced not flushing CPU_cache\n");
53+
} else if (e && (strcmp(e, "0") == 0)) {
54+
flush = 1;
55+
printf("Forced flushing CPU_cache\n");
56+
}
4657

4758
pmw = (PMEM_WRAPPER*) malloc(sizeof(PMEM_WRAPPER));
4859
if (!pmw)

0 commit comments

Comments
 (0)