Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190716184119.GH14271@linux.ibm.com>
Date: Tue, 16 Jul 2019 11:41:19 -0700
From: "Paul E. McKenney" <paulmck@...ux.ibm.com>
To: "Joel Fernandes (Google)" <joel@...lfernandes.org>
Cc: linux-kernel@...r.kernel.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>,
        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,
        "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>
Subject: Re: [PATCH 6/9] workqueue: Convert for_each_wq to use built-in list
 check (v2)

On Mon, Jul 15, 2019 at 10:37:02AM -0400, Joel Fernandes (Google) wrote:
> 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>

We need an ack from one of the subsystem maintainers on this one.

							Thanx, Paul

> ---
>  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.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.