rcu.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] workqueue: Convert for_each_wq to use built-in list check (v2)
@ 2019-08-11 22:11 Joel Fernandes (Google)
  2019-08-11 22:11 ` [PATCH 2/3] doc: Update documentation about list_for_each_entry_rcu (v1) Joel Fernandes (Google)
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Joel Fernandes (Google) @ 2019-08-11 22:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Joel Fernandes (Google),
	Greg Kroah-Hartman, Jonathan Corbet, Josh Triplett,
	Lai Jiangshan, linux-doc, Mathieu Desnoyers, Paul E. McKenney,
	Rafael J. Wysocki, rcu, Steven Rostedt, Tejun Heo

list_for_each_entry_rcu now has support to check for RCU reader sections
as well as lock. Just use the support in it, instead of explicitly
checking in the caller.

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 kernel/workqueue.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 601d61150b65..e882477ebf6e 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -364,11 +364,6 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq);
 			 !lockdep_is_held(&wq_pool_mutex),		\
 			 "RCU or wq_pool_mutex should be held")
 
-#define assert_rcu_or_wq_mutex(wq)					\
-	RCU_LOCKDEP_WARN(!rcu_read_lock_held() &&			\
-			 !lockdep_is_held(&wq->mutex),			\
-			 "RCU or wq->mutex should be held")
-
 #define assert_rcu_or_wq_mutex_or_pool_mutex(wq)			\
 	RCU_LOCKDEP_WARN(!rcu_read_lock_held() &&			\
 			 !lockdep_is_held(&wq->mutex) &&		\
@@ -425,9 +420,8 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq);
  * ignored.
  */
 #define for_each_pwq(pwq, wq)						\
-	list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node)		\
-		if (({ assert_rcu_or_wq_mutex(wq); false; })) { }	\
-		else
+	list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node,		\
+				 lock_is_held(&(wq->mutex).dep_map))
 
 #ifdef CONFIG_DEBUG_OBJECTS_WORK
 
-- 
2.23.0.rc1.153.gdeed80330f-goog


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-08-14 22:42 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-11 22:11 [PATCH 1/3] workqueue: Convert for_each_wq to use built-in list check (v2) Joel Fernandes (Google)
2019-08-11 22:11 ` [PATCH 2/3] doc: Update documentation about list_for_each_entry_rcu (v1) Joel Fernandes (Google)
2019-08-12 20:22   ` Paul E. McKenney
2019-08-12 20:42     ` Joel Fernandes
2019-08-12 21:24       ` Paul E. McKenney
2019-08-11 22:11 ` [PATCH 3/3] driver/core: Fix build error when SRCU and lockdep disabled Joel Fernandes (Google)
2019-08-12  5:02   ` Greg Kroah-Hartman
2019-08-12 13:03     ` Joel Fernandes
2019-08-12 18:11       ` Steven Rostedt
2019-08-12 20:01         ` Joel Fernandes
2019-08-12 20:05           ` Steven Rostedt
2019-08-11 22:12 ` [PATCH 1/3] workqueue: Convert for_each_wq to use built-in list check (v2) Joel Fernandes
2019-08-14 19:48 ` Tejun Heo
2019-08-14 22:42   ` Joel Fernandes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).