From: Mathieu Desnoyers Date: Thu, 23 Oct 2014 15:27:58 +0000 (-0400) Subject: workqueue: ensure worker is removed from waitqueue upon unregister X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6e17009c7e4276b3a90aada07e7c9835e9a788be;p=urcu.git workqueue: ensure worker is removed from waitqueue upon unregister Signed-off-by: Mathieu Desnoyers --- diff --git a/urcu/workqueue-fifo.h b/urcu/workqueue-fifo.h index 6256bff..1292e04 100644 --- a/urcu/workqueue-fifo.h +++ b/urcu/workqueue-fifo.h @@ -159,13 +159,10 @@ void urcu_worker_unregister(struct urcu_workqueue *queue, } /* - * Wait for grace period before freeing or reusing - * "worker" because used by RCU linked list. - * Also prevents ABA for waitqueue stack dequeue: matches RCU - * read-side critical sections around dequeue and move all - * operations on waitqueue). + * Make sure we are removed from waitqueue. */ - synchronize_rcu(); + if (CMM_LOAD_SHARED(worker->wait_node.node.next)) + __urcu_workqueue_wakeup_all(queue); /* * Put any local work we still have back into the workqueue. @@ -184,6 +181,15 @@ void urcu_worker_unregister(struct urcu_workqueue *queue, (void) urcu_dequeue_wake_single(&queue->waitqueue); rcu_read_unlock(); /* Protect stack dequeue */ } + + /* + * Wait for grace period before freeing or reusing + * "worker" because used by RCU linked list. + * Also prevents ABA for waitqueue stack dequeue: matches RCU + * read-side critical sections around dequeue and move all + * operations on waitqueue). + */ + synchronize_rcu(); } /*