X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=test_perthreadlock_timing.c;h=3e8268b6d7085c15d6a5de4ee1124ebcac77efca;hp=625f999daf4d404ce1af78f3ebb1909e18d2da2a;hb=c97ae6eb5bf6baea503d9df98e8376c0bd36b629;hpb=2c9689fe0485146fc5ff5e5023c941629eee124d diff --git a/test_perthreadlock_timing.c b/test_perthreadlock_timing.c index 625f999..3e8268b 100644 --- a/test_perthreadlock_timing.c +++ b/test_perthreadlock_timing.c @@ -33,6 +33,9 @@ #include #include +/* Make this big enough to include the POWER5+ L3 cacheline size of 256B */ +#define CACHE_LINE_SIZE 4096 + #if defined(_syscall0) _syscall0(pid_t, gettid) #elif defined(__NR_gettid) @@ -58,7 +61,7 @@ static struct test_array test_array = { 8 }; struct per_thread_lock { pthread_mutex_t lock; -} __attribute__((aligned(128))); /* cache-line aligned */ +} __attribute__((aligned(CACHE_LINE_SIZE))); /* cache-line aligned */ static struct per_thread_lock *per_thread_lock; @@ -76,8 +79,8 @@ static int num_write; #define NR_READ num_read #define NR_WRITE num_write -static cycles_t __attribute__((aligned(128))) *reader_time; -static cycles_t __attribute__((aligned(128))) *writer_time; +static cycles_t __attribute__((aligned(CACHE_LINE_SIZE))) *reader_time; +static cycles_t __attribute__((aligned(CACHE_LINE_SIZE))) *writer_time; void *thr_reader(void *arg) {