Skip to content

Commit 360e635

Browse files
om-saranOmSaran
authored andcommitted
Use CLFLUSH when CLFLUSHOPT is not available
Use the compiler argument -march=native to know if CLFLUSHOPT is supported
1 parent ddf62f8 commit 360e635

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ The kernel patch for the implementation of relink() system call for linux v4.13
8989
2. At least 32 GB DRAM
9090
3. At least 4 cores
9191
4. Baremetal machine (Not a VM)
92-
5. Intel Processor supporting `clflushopt` instruction (Introduced in Intel processor family -- Broadwell). This can be verified with `lscpu | grep clflushopt`
92+
5. Intel Processor supporting `clflush` or `clflushopt` (Introduced in Intel processor family -- Broadwell) instruction. This can be verified with `lscpu | grep clflush`. `clflushopt` will lead to better performance in strict mode.
9393

9494
## Dependencies
9595
1. kernel: Installing the linux kernel 4.13.0 involves installing bc, libelf-dev and libncurses5-dev. For ubuntu, please run the script `cd dependencies; ./kernel_deps.sh; cd ..`

splitfs/common.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ COPTIMIZATIONS = -O3 -m64
9191
#-march=core2 -minline-all-stringops -m64 -fprefetch-loop-arrays
9292
#-mno-align-stringops
9393
#-DTRACE_FP_CALLS=$(LEDGER_TRACE_FP)
94-
CFLAGS = -DPRINT_DEBUG_FILE=$(LEDGER_DEBUG) -DDATA_JOURNALING_ENABLED=$(LEDGER_DATAJ) -DPOSIX_ENABLED=$(LEDGER_POSIX) -DTRACE_FP_CALLS=$(LEDGER_TRACE_FP) -DNVM_DELAY=$(DELAYS) -DNON_TEMPORAL_WRITES=$(MOVNTI) -DSYSCALL_APPENDS=$(SYS_APPENDS) -DPASS_THROUGH_CALLS=$(SYS_PASS_THROUGH) -DBG_CLEANING=$(LEDGER_DR_BG_CLEAN) -DINSTRUMENT_CALLS=$(LEDGER_INSTRU) -DWORKLOAD_YCSB=$(LEDGER_YCSB) -DWORKLOAD_TPCC=$(LEDGER_TPCC) -DWORKLOAD_REDIS=$(LEDGER_REDIS) -DWORKLOAD_TAR=$(LEDGER_TAR) -DWORKLOAD_GIT=$(LEDGER_GIT) -DWORKLOAD_RSYNC=$(LEDGER_RSYNC) -DSHOW_DEBUG=$(LIBNVP_DEBUG) -DSPIN_ON_ERROR=$(LIBNVP_SPIN_ON_ERROR) -Wno-unused-variable -Wall -Wundef -pthread -fPIC $(COPTIMIZATIONS) -D$(SYSTEM_TYPE) -DUSE_PTHREAD_LOCK=$(USE_PTHREAD_LOCK) -DUSE_SCHED_GETCPU=$(USE_SCHED_GETCPU) -DINTEGRITY_CHECK=$(INTEGRITY_CHECK) -DMEASURE_TIMING=$(MEASURE_TIMING) -DUSE_SINGLE_LOCK=$(USE_SINGLE_LOCK) -DENABLE_FSYNC_TO_BS=$(ENABLE_FSYNC_TO_BS) -DENABLE_FSYNC_TO_CACHE=$(ENABLE_FSYNC_TO_CACHE) -DENABLE_FALLOC=$(ENABLE_FALLOC) -DUSE_BTREE=$(USE_BTREE) -DUNMAP_ON_CLOSE=$(UNMAP_ON_CLOSE)
94+
CFLAGS = -march=native -DPRINT_DEBUG_FILE=$(LEDGER_DEBUG) -DDATA_JOURNALING_ENABLED=$(LEDGER_DATAJ) -DPOSIX_ENABLED=$(LEDGER_POSIX) -DTRACE_FP_CALLS=$(LEDGER_TRACE_FP) -DNVM_DELAY=$(DELAYS) -DNON_TEMPORAL_WRITES=$(MOVNTI) -DSYSCALL_APPENDS=$(SYS_APPENDS) -DPASS_THROUGH_CALLS=$(SYS_PASS_THROUGH) -DBG_CLEANING=$(LEDGER_DR_BG_CLEAN) -DINSTRUMENT_CALLS=$(LEDGER_INSTRU) -DWORKLOAD_YCSB=$(LEDGER_YCSB) -DWORKLOAD_TPCC=$(LEDGER_TPCC) -DWORKLOAD_REDIS=$(LEDGER_REDIS) -DWORKLOAD_TAR=$(LEDGER_TAR) -DWORKLOAD_GIT=$(LEDGER_GIT) -DWORKLOAD_RSYNC=$(LEDGER_RSYNC) -DSHOW_DEBUG=$(LIBNVP_DEBUG) -DSPIN_ON_ERROR=$(LIBNVP_SPIN_ON_ERROR) -Wno-unused-variable -Wall -Wundef -pthread -fPIC $(COPTIMIZATIONS) -D$(SYSTEM_TYPE) -DUSE_PTHREAD_LOCK=$(USE_PTHREAD_LOCK) -DUSE_SCHED_GETCPU=$(USE_SCHED_GETCPU) -DINTEGRITY_CHECK=$(INTEGRITY_CHECK) -DMEASURE_TIMING=$(MEASURE_TIMING) -DUSE_SINGLE_LOCK=$(USE_SINGLE_LOCK) -DENABLE_FSYNC_TO_BS=$(ENABLE_FSYNC_TO_BS) -DENABLE_FSYNC_TO_CACHE=$(ENABLE_FSYNC_TO_CACHE) -DENABLE_FALLOC=$(ENABLE_FALLOC) -DUSE_BTREE=$(USE_BTREE) -DUNMAP_ON_CLOSE=$(UNMAP_ON_CLOSE)
9595

9696
CXXFLAGS=$(CFLAGS)
9797

splitfs/non_temporal.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@
5050
#define MOVNT_THRESHOLD_GRANULARITY 64
5151

5252
#define CLFLUSH_SIZE 64
53-
#define _mm_clflushopt(addr)\
54-
asm volatile("clflushopt %0" : "+m" (*(volatile char *)(addr)))
53+
#ifndef __CLFLUSHOPT__
54+
#define _mm_clflushopt(addr)\
55+
asm volatile("clflush %0" : "+m" (*(volatile char *)(addr)))
56+
#else
57+
#define _mm_clflushopt(addr)\
58+
asm volatile("clflushopt %0" : "+m" (*(volatile char *)(addr)))
59+
#endif
5560

5661

5762
char *addr;

0 commit comments

Comments
 (0)