From: Mathieu Desnoyers Date: Fri, 23 Oct 2009 11:57:28 +0000 (-0400) Subject: urcu-defer: remove call_rcu() API, replace by defer_rcu() X-Git-Tag: v0.3.0~7 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b4f313b7ffb3215d54790f303c2ff3e4a41e5919;p=urcu.git urcu-defer: remove call_rcu() API, replace by defer_rcu() Ensure we do not expose an API different from the kernel with the same name and different semantic. defer_rcu() cannot be called from within a RCU read-side C.S.. call_rcu() should eventually be re-implemented with struct rcu_head, permitting to be called from within a RCU read-side C.S. Signed-off-by: Mathieu Desnoyers --- diff --git a/tests/test_urcu_defer.c b/tests/test_urcu_defer.c index 309c3b2..72c598b 100644 --- a/tests/test_urcu_defer.c +++ b/tests/test_urcu_defer.c @@ -236,14 +236,14 @@ void *thr_writer(void *data) new = malloc(sizeof(*new)); new->a = 8; old = rcu_xchg_pointer(&test_rcu_pointer, new); - call_rcu(free, old); - call_rcu(test_cb1, old); - call_rcu(test_cb1, (void *)-2L); - call_rcu(test_cb1, (void *)-2L); - call_rcu(test_cb1, old); - call_rcu(test_cb2, (void *)-2L); - call_rcu(test_cb2, (void *)-4L); - call_rcu(test_cb2, (void *)-2L); + defer_rcu(free, old); + defer_rcu(test_cb1, old); + defer_rcu(test_cb1, (void *)-2L); + defer_rcu(test_cb1, (void *)-2L); + defer_rcu(test_cb1, old); + defer_rcu(test_cb2, (void *)-2L); + defer_rcu(test_cb2, (void *)-4L); + defer_rcu(test_cb2, (void *)-2L); nr_writes++; if (unlikely(!test_duration_write())) break; diff --git a/urcu-defer.c b/urcu-defer.c index ed627a3..dd57071 100644 --- a/urcu-defer.c +++ b/urcu-defer.c @@ -230,9 +230,9 @@ end: } /* - * _rcu_defer_queue - Queue a RCU callback. + * _defer_rcu - Queue a RCU callback. */ -void _rcu_defer_queue(void (*fct)(void *p), void *p) +void _defer_rcu(void (*fct)(void *p), void *p) { unsigned long head, tail; @@ -315,9 +315,9 @@ void *thr_defer(void *args) * library wrappers to be used by non-LGPL compatible source code. */ -void rcu_defer_queue(void (*fct)(void *p), void *p) +void defer_rcu(void (*fct)(void *p), void *p) { - _rcu_defer_queue(fct, p); + _defer_rcu(fct, p); } static void start_defer_thread(void) diff --git a/urcu-defer.h b/urcu-defer.h index e32156c..9fdaf18 100644 --- a/urcu-defer.h +++ b/urcu-defer.h @@ -39,15 +39,13 @@ * rcu_defer_register_thread(). rcu_defer_unregister_thread() should be * called before the thread exits. * - * *NEVER* use call_rcu()/rcu_defer_queue() within a RCU read-side critical - * section, because this primitive need to call synchronize_rcu() if the thread - * queue is full. + * *NEVER* use defer_rcu() within a RCU read-side critical section, because this + * primitive need to call synchronize_rcu() if the thread queue is full. */ -#define call_rcu rcu_defer_queue -#define rcu_reclaim_queue(p) rcu_defer_queue(free, p) +#define rcu_reclaim_queue(p) defer_rcu(free, p) -extern void rcu_defer_queue(void (*fct)(void *p), void *p); +extern void defer_rcu(void (*fct)(void *p), void *p); /* * Thread registration for reclamation.