All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Fernandes <joel@joelfernandes.org>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org,
	Tong Tiangen <tongtiangen@huawei.com>,
	rcu@vger.kernel.org
Subject: Re: [PATCH] sched: Assert for_each_thread() is properly locked
Date: Mon, 21 Aug 2023 17:55:54 +0000	[thread overview]
Message-ID: <20230821175554.GA595469@google.com> (raw)
In-Reply-To: <20230821134428.2504912-1-willy@infradead.org>

On Mon, Aug 21, 2023 at 02:44:28PM +0100, Matthew Wilcox (Oracle) wrote:
> list_for_each_entry_rcu() takes an optional fourth argument which
> allows RCU to assert that the correct lock is held.  Several callers
> of for_each_thread() rely on their caller to be holding the appropriate
> lock, so this is a useful assertion to include.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>

thanks,

 - Joel


> ---
>  include/linux/sched/signal.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
> index 669e8cff40c7..f1eae7f53be9 100644
> --- a/include/linux/sched/signal.h
> +++ b/include/linux/sched/signal.h
> @@ -659,7 +659,8 @@ extern bool current_is_single_threaded(void);
>  	while ((t = next_thread(t)) != g)
>  
>  #define __for_each_thread(signal, t)	\
> -	list_for_each_entry_rcu(t, &(signal)->thread_head, thread_node)
> +	list_for_each_entry_rcu(t, &(signal)->thread_head, thread_node, \
> +		lockdep_is_held(&tasklist_lock))
>  
>  #define for_each_thread(p, t)		\
>  	__for_each_thread((p)->signal, t)
> -- 
> 2.40.1
> 

  reply	other threads:[~2023-08-21 17:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-21 13:44 [PATCH] sched: Assert for_each_thread() is properly locked Matthew Wilcox (Oracle)
2023-08-21 17:55 ` Joel Fernandes [this message]
2023-09-15  8:36 ` [tip: sched/core] " tip-bot2 for Matthew Wilcox (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230821175554.GA595469@google.com \
    --to=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rcu@vger.kernel.org \
    --cc=tongtiangen@huawei.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.