Did you still need asynchronous grace-period detection?
Hello, Peter,
The following commit seems to have been dropped on the floor. Given that you haven't complained, I feel the need to ask you if you still need it. ;-)
If you do need it, I will push it into 3.16.
Thanx, Paul
------------------------------------------------------------------------
rcu: Provide grace-period piggybacking API
The following pattern is currently not well supported by RCU:
1. Make data element inaccessible to RCU readers.
2. Do work that probably lasts for more than one grace period.
3. Do something to make sure RCU readers in flight before #1 above
have completed.
Here are some things that could currently be done:
a. Do a synchronize_rcu() unconditionally at either #1 or #3 above.
This works, but imposes needless work and latency.
b. Post an RCU callback at #1 above that does a wakeup, then
wait for the wakeup at #3. This works well, but likely results in an extra unneeded grace period. Open-coding this is also a bit more semi-tricky code than would be good.
This commit therefore adds get_state_synchronize_rcu() and cond_synchronize_rcu() APIs. Call get_state_synchronize_rcu() at #1 above and pass its return value to cond_synchronize_rcu() at #3 above. This results in a call to synchronize_rcu() if no grace period has elapsed between #1 and #3, but requires only a load, comparison, and memory barrier if a full grace period did elapse.
include/linux/rcutiny.h +10 -0
@@ -27,6 +27,16 @@#include <linux/cache.h> +static inline unsigned long get_state_synchronize_rcu (void ) +{ +return 0 ; +} + +static inline void cond_synchronize_rcu (unsigned long oldstate) +{ +might_sleep (); +} +static inline void rcu_barrier_bh (void ) {wait_rcu_gp (call_rcu_bh);
include/linux/rcutree.h +2 -0
@@ -76,6 +76,8 @@ static inline void synchronize_rcu_bh_expedited(void)void rcu_barrier (void );void rcu_barrier_bh (void );void rcu_barrier_sched (void ); +unsigned long get_state_synchronize_rcu (void ); +void cond_synchronize_rcu (unsigned long oldstate);extern unsigned long rcutorture_testseq;extern unsigned long rcutorture_vernum;
kernel/rcu/tree.c +58 -4
87 lines not on this page · raw message
Quoted 8 lines · Paul E. McKenney
Hello, Peter,
The following commit seems to have been dropped on the floor. Given that you haven't complained, I feel the need to ask you if you still need it. ;-)
If you do need it, I will push it into 3.16.
Yes, I do.. thanks for reminding me, I'll need to go find the patch that needs it :-)
Quoted 11 lines · Peter Zijlstra
Quoted 7 lines · Paul E. McKenney
Hello, Peter,
The following commit seems to have been dropped on the floor. Given that you haven't complained, I feel the need to ask you if you still need it. ;-)
If you do need it, I will push it into 3.16.
Yes, I do.. thanks for reminding me, I'll need to go find the patch that needs it :-)
No problem!
And it turns out that it is in fact in mainline. I was looking at an obsolete patch, thus looking in the wrong place for it. :-/
Good thing I didn't try to add it again...
Thanx, Paul