All of lore.kernel.org
 help / color / mirror / Atom feed
From: Valentin Schneider <valentin.schneider@arm.com>
To: Mel Gorman <mgorman@techsingularity.net>
Cc: Qian Cai <cai@lca.pw>, Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Juri Lelli <juri.lelli@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	paulmck@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: suspicious RCU due to "Prefer using an idle CPU as a migration target instead of comparing tasks"
Date: Thu, 27 Feb 2020 17:30:40 +0000	[thread overview]
Message-ID: <jhjeeugvsxr.mognet@arm.com> (raw)
In-Reply-To: <20200227171934.GI3818@techsingularity.net>

On Thu, Feb 27 2020, Mel Gorman wrote:
> Thanks for reporting this!
>
> The proposed fix would be a lot of rcu locks and unlocks. While they are
> cheap, they're not free and it's a fairly standard pattern to acquire
> the rcu lock when scanning CPUs during a domain search (load balancing,
> nohz balance, idle balance etc). While in this context the lock is only
> needed for SMT, I do not think it's worthwhile fine-graining this or
> conditionally acquiring the rcu lock so will we keep it simple?
>
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 11cdba201425..d34ac4ea5cee 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1592,6 +1592,7 @@ static void update_numa_stats(struct task_numa_env *env,
>       memset(ns, 0, sizeof(*ns));
>       ns->idle_cpu = -1;
>
> +	rcu_read_lock();
>       for_each_cpu(cpu, cpumask_of_node(nid)) {
>               struct rq *rq = cpu_rq(cpu);
>
> @@ -1611,6 +1612,7 @@ static void update_numa_stats(struct task_numa_env *env,
>                       idle_core = numa_idle_core(idle_core, cpu);
>               }
>       }
> +	rcu_read_unlock();
>
>       ns->weight = cpumask_weight(cpumask_of_node(nid));
>


That's closer to what I was trying to suggest (i.e. broaden the section
rather than reduce it).

  reply	other threads:[~2020-02-27 17:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 14:09 suspicious RCU due to "Prefer using an idle CPU as a migration target instead of comparing tasks" Qian Cai
2020-02-27 14:47 ` Qian Cai
2020-02-27 15:26   ` Valentin Schneider
2020-02-27 16:35     ` Qian Cai
2020-02-27 16:47       ` Qian Cai
2020-02-27 17:19         ` Mel Gorman
2020-02-27 17:30           ` Valentin Schneider [this message]
2020-02-27 18:56           ` Paul E. McKenney

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=jhjeeugvsxr.mognet@arm.com \
    --to=valentin.schneider@arm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=cai@lca.pw \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@techsingularity.net \
    --cc=mingo@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=rostedt@goodmis.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.