[lttng-dev] [PATCH urcu 1/4] Fix: mixup between URCU_WORKQUEUE_RT and URCU_CALL_RCU_RT

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Sun Dec 9 06:54:47 EST 2018

----- On Dec 7, 2018, at 5:06 PM, Jeremie Galarneau jeremie.galarneau at efficios.com wrote:

> The work queue implementation is derived from the call-rcu thread. A
> number of references seem to have been left in place when adapting the
> code for its new purpose.

All 4 patches merged into master, stable-0.10. It is not needed in
stable-0.9 because workqueue.c was only introduced in 0.10. One
thing to keep in mind: workqueue.{c,h} is an internal API for now,
so there is really only just a single user of this API (rculfhash)
at the moment.

I added two additional patches, for the following sequences of

5bbe95b Fix: only wait if work queue is empty in real-time mode
c6871b6 Fix: don't wait after completion of a work queue job batch
73d8b52 Fix: don't wait after completion of job batch if work queue is empty
d25f25d Fix: workqueue: struct urcu_work vs rcu_head mixup
1b6fc17 Cleanup: workqueue: update comments referring to call-rcu
9db9edc Fix: mixup between URCU_WORKQUEUE_RT and URCU_CALL_RCU_RT



> The URCU_CALL_RCU_RT flag is used by wake_worker_thread() while the
> rest of the workqueue.c code uses URCU_WORKQUEUE_RT to determine if
> the work queue was configured in real-time mode. Both flags are defined
> to the same value (0x1) and the current internal user of the
> work queue (lfht) never specifies any flags.
> In practice, this does not cause any problem so I doubt this patch
> needs to be backported. Feel free to rename "Fix" to "Clean-up".
> There are a number of comments referencing call-rcu which may need
> to be adapted. Changing them is left as an exercise to the maintainer
> as I don't know if they apply to the workqueue thread.
> Signed-off-by: Jérémie Galarneau <jeremie.galarneau at efficios.com>
> ---
> src/workqueue.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/src/workqueue.c b/src/workqueue.c
> index 17ea835..8561a7a 100644
> --- a/src/workqueue.c
> +++ b/src/workqueue.c
> @@ -309,7 +309,7 @@ struct urcu_workqueue *urcu_workqueue_create(unsigned long
> flags,
> static void wake_worker_thread(struct urcu_workqueue *workqueue)
> {
> -	if (!(_CMM_LOAD_SHARED(workqueue->flags) & URCU_CALL_RCU_RT))
> +	if (!(_CMM_LOAD_SHARED(workqueue->flags) & URCU_WORKQUEUE_RT))
> 		futex_wake_up(&workqueue->futex);
> }
> --
> 2.19.2

Mathieu Desnoyers
EfficiOS Inc.

More information about the lttng-dev mailing list