X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=urcu%2Fstatic%2Furcu-qsbr.h;h=68bfc31f540ee07adbb0701251adac9ccb0434b5;hb=cc6b0c208a9707f8a64609a51167290caeace288;hp=a9f4d8b264835afab0442a7f304bc91e11f077b4;hpb=6d841bc23fc94345fe76651d73c1a3f821a85aa7;p=urcu.git diff --git a/urcu/static/urcu-qsbr.h b/urcu/static/urcu-qsbr.h index a9f4d8b..68bfc31 100644 --- a/urcu/static/urcu-qsbr.h +++ b/urcu/static/urcu-qsbr.h @@ -33,7 +33,6 @@ #include #include #include -#include #include #include @@ -56,18 +55,6 @@ extern "C" { * This is required to permit relinking with newer versions of the library. */ -/* - * If a reader is really non-cooperative and refuses to commit its - * rcu_reader.ctr count to memory (there is no barrier in the reader - * per-se), kick it after a few loops waiting for it. - */ -#define KICK_READER_LOOPS 10000 - -/* - * Active attempts to check for reader Q.S. before calling futex(). - */ -#define RCU_QS_ACTIVE_ATTEMPTS 100 - #ifdef DEBUG_RCU #define rcu_assert(args...) assert(args) #else @@ -137,6 +124,7 @@ struct rcu_reader { unsigned long ctr; /* Data used for registry */ struct cds_list_head node __attribute__((aligned(CAA_CACHE_LINE_SIZE))); + int waiting; pthread_t tid; }; @@ -149,7 +137,11 @@ extern int32_t gp_futex; */ static inline void wake_up_gp(void) { - if (unlikely(uatomic_read(&gp_futex) == -1)) { + if (caa_unlikely(_CMM_LOAD_SHARED(rcu_reader.waiting))) { + _CMM_STORE_SHARED(rcu_reader.waiting, 0); + cmm_smp_mb(); + if (uatomic_read(&gp_futex) != -1) + return; uatomic_set(&gp_futex, 0); futex_noasync(&gp_futex, FUTEX_WAKE, 1, NULL, NULL, 0);