Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190712170024.111093-7-joel@joelfernandes.org>
Date: Fri, 12 Jul 2019 13:00:21 -0400
From: "Joel Fernandes (Google)" <joel@...lfernandes.org>
To: linux-kernel@...r.kernel.org
Cc: "Joel Fernandes (Google)" <joel@...lfernandes.org>,
	Alexey Kuznetsov <kuznet@....inr.ac.ru>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Borislav Petkov <bp@...en8.de>,
	c0d1n61at3@...il.com,
	"David S. Miller" <davem@...emloft.net>,
	edumazet@...gle.com,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
	"H. Peter Anvin" <hpa@...or.com>,
	Ingo Molnar <mingo@...hat.com>,
	Jonathan Corbet <corbet@....net>,
	Josh Triplett <josh@...htriplett.org>,
	keescook@...omium.org,
	kernel-hardening@...ts.openwall.com,
	kernel-team@...roid.com,
	Lai Jiangshan <jiangshanlai@...il.com>,
	Len Brown <lenb@...nel.org>,
	linux-acpi@...r.kernel.org,
	linux-doc@...r.kernel.org,
	linux-pci@...r.kernel.org,
	linux-pm@...r.kernel.org,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	neilb@...e.com,
	netdev@...r.kernel.org,
	Oleg Nesterov <oleg@...hat.com>,
	"Paul E. McKenney" <paulmck@...ux.ibm.com>,
	Pavel Machek <pavel@....cz>,
	peterz@...radead.org,
	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Rasmus Villemoes <rasmus.villemoes@...vas.dk>,
	rcu@...r.kernel.org,
	Steven Rostedt <rostedt@...dmis.org>,
	Tejun Heo <tj@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	will@...nel.org,
	x86@...nel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT))
Subject: [PATCH v2 6/9] workqueue: Convert for_each_wq to use built-in list check

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 explictly
checking in the caller.

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

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 9657315405de..5e88449bdd83 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -363,11 +363,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) &&		\
@@ -424,9 +419,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.22.0.510.g264f2c817a-goog

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.