History

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.

Sebastian Andrzej Siewior committed 6 years ago

Commit 49e9d1a1 parent e66b39a1 file · +2 −1Browse files

Showing the changes to kernel/workqueue.c (1 of 1 file). Show all

Unified · Split

kernel/workqueue.c+2−1
@@ -426,7 +426,8 @@ static void show_pwq(struct pool_workqueue *pwq); · 425 unmodified lines
426 * ignored.426 * ignored.
427 */427 */
428#define for_each_pwq(pwq, wq) \428#define for_each_pwq(pwq, wq) \
429 list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node) \429 list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node, \
430 lockdep_is_held(&wq->mutex)) \
430 if (({ assert_rcu_or_wq_mutex(wq); false; })) { } \431 if (({ assert_rcu_or_wq_mutex(wq); false; })) { } \
431 else432 else
432 433