The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: qiang.zhang@windriver.com
Cc: valentin.schneider@arm.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/core: add rcu_read_lock/unlock() protection
Date: Tue, 26 Jan 2021 10:20:13 +0100	[thread overview]
Message-ID: <YA/ezfU+/2ggZKTy@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20210126084651.32277-1-qiang.zhang@windriver.com>

On Tue, Jan 26, 2021 at 04:46:51PM +0800, qiang.zhang@windriver.com wrote:
> From: Zqiang <qiang.zhang@windriver.com>
> 
> Due to for_each_process_thread belongs to RCU read operation,
> need to add rcu_read_lock/unlock() protection.
> 
> Signed-off-by: Zqiang <qiang.zhang@windriver.com>
> ---
>  kernel/sched/core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 8c5481077c9c..c3f0103fdf53 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -7738,6 +7738,7 @@ static void dump_rq_tasks(struct rq *rq, const char *loglvl)
>  	lockdep_assert_held(&rq->lock);
>  
>  	printk("%sCPU%d enqueued tasks (%u total):\n", loglvl, cpu, rq->nr_running);
> +	rcu_read_lock();
>  	for_each_process_thread(g, p) {
>  		if (task_cpu(p) != cpu)
>  			continue;
> @@ -7747,6 +7748,7 @@ static void dump_rq_tasks(struct rq *rq, const char *loglvl)
>  
>  		printk("%s\tpid: %d, name: %s\n", loglvl, p->pid, p->comm);
>  	}
> +	rcu_read_unlock();

We're in stop machine, with IRQs disabled, please explain how this can
make any difference?

  reply	other threads:[~2021-01-26 11:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-26  8:46 [PATCH] sched/core: add rcu_read_lock/unlock() protection qiang.zhang
2021-01-26  9:20 ` Peter Zijlstra [this message]
2021-01-26  9:23 ` 回复: " Zhang, Qiang

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=YA/ezfU+/2ggZKTy@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qiang.zhang@windriver.com \
    --cc=valentin.schneider@arm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox