Skip to content

Commit 1612894

Browse files
Sebastian Andrzej Siewiorgregkh
authored andcommitted
workqueue: Add RCU annotation for pwq list walk
[ Upstream commit 49e9d1a ] 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: 2887594 ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b30a9b0 commit 1612894

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

kernel/workqueue.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,8 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq);
425425
* ignored.
426426
*/
427427
#define for_each_pwq(pwq, wq) \
428-
list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node) \
428+
list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node, \
429+
lockdep_is_held(&wq->mutex)) \
429430
if (({ assert_rcu_or_wq_mutex(wq); false; })) { } \
430431
else
431432

0 commit comments

Comments
 (0)