X-Git-Url: https://git.lttng.org/?p=urcu.git;a=blobdiff_plain;f=tests%2Ftest_qsbr.c;h=5284a4837bc9fdd0e69e28db4bbec6774ae0e67a;hp=89a94235eedb3d8ddf0d1e542e45017daf503ee2;hb=94b343fd8d68512d78d8646c646c15a1b3f84186;hpb=833dbdb633ba44bfb71b4b965a83096d8e4e827b diff --git a/tests/test_qsbr.c b/tests/test_qsbr.c index 89a9423..5284a48 100644 --- a/tests/test_qsbr.c +++ b/tests/test_qsbr.c @@ -32,11 +32,9 @@ #include #include #include +#include -#include "../arch.h" - -/* Make this big enough to include the POWER5+ L3 cacheline size of 256B */ -#define CACHE_LINE_SIZE 4096 +#include /* hardcoded number of CPUs */ #define NR_CPUS 16384 @@ -56,8 +54,12 @@ static inline pid_t gettid(void) } #endif +#ifndef DYNAMIC_LINK_TEST #define _LGPL_SOURCE -#include "../urcu-qsbr.h" +#else +#define debug_yield_read() +#endif +#include "urcu-qsbr.h" struct test_array { int a; @@ -215,18 +217,18 @@ void *thr_reader(void *_count) smp_mb(); for (;;) { - _rcu_read_lock(); - local_ptr = _rcu_dereference(test_rcu_pointer); + rcu_read_lock(); + local_ptr = rcu_dereference(test_rcu_pointer); debug_yield_read(); if (local_ptr) assert(local_ptr->a == 8); if (unlikely(rduration)) loop_sleep(rduration); - _rcu_read_unlock(); + rcu_read_unlock(); nr_reads++; /* QS each 1024 reads */ if (unlikely((nr_reads & ((1 << 10) - 1)) == 0)) - _rcu_quiescent_state(); + rcu_quiescent_state(); if (unlikely(!test_duration_read())) break; } @@ -258,7 +260,8 @@ void *thr_writer(void *_count) for (;;) { new = test_array_alloc(); new->a = 8; - old = _rcu_publish_content(&test_rcu_pointer, new); + old = rcu_xchg_pointer(&test_rcu_pointer, new); + synchronize_rcu(); /* can be done after unlock */ if (old) old->a = 0;