X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=urcu-qsbr.c;h=c678d38779eb683f1f78872a87e853a4c281f43d;hb=935b11ff4cf9053954d21b9d63c4ee367b12a652;hp=84789f2ebfdd4fa89def6fb56274595739a51d02;hpb=32c15e4e6fa2c368f4649d904c91e4293a1193e3;p=urcu.git diff --git a/urcu-qsbr.c b/urcu-qsbr.c index 84789f2..c678d38 100644 --- a/urcu-qsbr.c +++ b/urcu-qsbr.c @@ -120,6 +120,17 @@ static void update_counter_and_wait(void) STORE_SHARED(rcu_gp_ctr, rcu_gp_ctr + RCU_GP_CTR); #endif /* !(BITS_PER_LONG < 64) */ + /* + * Enforce compiler-order of store to rcu_gp_ctr before before + * load rcu_reader ctr. + * This ensures synchronize_rcu() cannot be starved by readers. + * + * Adding a smp_mb() which is _not_ formally required, but makes the + * model easier to understand. It does not have a big performance impact + * anyway, given this is the write-side. + */ + smp_mb(); + /* * Wait for each thread rcu_reader_qs_gp count to become 0. */