]> git.lttng.org Git - userspace-rcu.git/commitdiff
Fix: workqueue: struct urcu_work vs rcu_head mixup
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 9 Dec 2018 11:37:09 +0000 (06:37 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 9 Dec 2018 11:45:00 +0000 (06:45 -0500)
The workqueue code was derived from call-rcu, and its API
expects a struct urcu_work for work items, but it internally iterates
over struct rcu_head.

This is not an issue at runtime because both structures have the
exact same layout and content, but it is a type mixup nevertheless.

Use the right type in the implementation.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/workqueue.c

index db0c63abf711307e995b3bd5cb372f560bd83711..6707ffe3b45e2c2226d99c3b163d4e1c820028aa 100644 (file)
@@ -221,11 +221,11 @@ static void *workqueue_thread(void *arg)
                        cbcount = 0;
                        __cds_wfcq_for_each_blocking_safe(&cbs_tmp_head,
                                        &cbs_tmp_tail, cbs, cbs_tmp_n) {
-                               struct rcu_head *rhp;
+                               struct urcu_work *uwp;
 
-                               rhp = caa_container_of(cbs,
-                                       struct rcu_head, next);
-                               rhp->func(rhp);
+                               uwp = caa_container_of(cbs,
+                                       struct urcu_work, next);
+                               uwp->func(uwp);
                                cbcount++;
                        }
                        uatomic_sub(&workqueue->qlen, cbcount);
This page took 0.03021 seconds and 4 git commands to generate.