Thanks for your wonderful project on memory allocation on persistent memory.
Note that there is some problem on opening optimized flush -- clflushopt and clwb.
the code in file <src/util.h> use Micro to open them but seems not in the right way (suppose we just want to define a HAS_CLWB to select clwb as persistent method)
#ifdef NOFLUSH
/* Completely disable flushes */
#define PERSIST(ptr) do { } while (0)
#define PERSIST_RANGE(ptr, len) do { } while (0)
#elif HAS_CLWB
/* CLWB is the preferred instruction, not invalidating any cache lines */
#define PERSIST(ptr) do { sfence() clwb(ptr); sfence(); } while (0)
#define PERSIST_RANGE(ptr, len) do { sfence(); clwb_range(ptr, len); sfence(); } while (0)
#elif HAS_CLFLUSHOPT
/* CLFLUSHOPT is preferred over CLFLUSH as only dirty cache lines will be evicted */
#define PERSIST(ptr) do { sfence(); clflushopt(ptr); sfence(); } while (0)
#define PERSIST_RANGE(ptr, len) do { sfence(); clflushopt_range(ptr, len); sfence(); } while (0)
#else
/* If neither CLWB nor CLFLUSHOPT are available, default to CLFLUSH */
#define PERSIST(ptr) do { mfence(); clflush(ptr); mfence(); } while (0)
#define PERSIST_RANGE(ptr, len) do { mfence(); clflush_range(ptr, len); mfence(); } while (0)
#endif
however, the following snippet, in my test, is the correct one:
Thanks for your wonderful project on memory allocation on persistent memory.
Note that there is some problem on opening optimized flush -- clflushopt and clwb.
the code in file <src/util.h> use Micro to open them but seems not in the right way (suppose we just want to define a HAS_CLWB to select clwb as persistent method)
however, the following snippet, in my test, is the correct one: