aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2019-11-15 19:01:25 +0100
committerTejun Heo <tj@kernel.org>2019-11-15 11:53:35 -0800
commit49e9d1a9faf2f71fdfd80a30697ee9a15070626d (patch)
tree46cce09b371206318000616b04536aa16f189e46
parentworkqueue: Fix pwq ref leak in rescuer_thread() (diff)
downloadlinux-dev-49e9d1a9faf2f71fdfd80a30697ee9a15070626d.tar.xz
linux-dev-49e9d1a9faf2f71fdfd80a30697ee9a15070626d.zip
workqueue: Add RCU annotation for pwq list walk
An additional check has been recently added to ensure that a RCU related lock is held while the RCU list is iterated. The `pwqs' are sometimes iterated without a RCU lock but with the &wq->mutex acquired leading to a warning. Teach list_for_each_entry_rcu() that the RCU usage is okay if &wq->mutex is acquired during the list traversal. Fixes: 28875945ba98d ("rcu: Add support for consolidated-RCU reader checking") Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r--kernel/workqueue.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 4dc8270326d7..914b845ad4ff 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -426,7 +426,8 @@ static void show_pwq(struct pool_workqueue *pwq);
* ignored.
*/
#define for_each_pwq(pwq, wq) \
- list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node) \
+ list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node, \
+ lockdep_is_held(&wq->mutex)) \
if (({ assert_rcu_or_wq_mutex(wq); false; })) { } \
else