mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@suse.de>
To: Hao Jia <jiahao.os@bytedance.com>
Cc: mingo@redhat.com, peterz@infradead.org, mingo@kernel.org,
	juri.lelli@redhat.com, vincent.guittot@linaro.org,
	dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com, bristot@redhat.com, vschneid@redhat.com,
	mgorman@techsingularity.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] sched/numa: Stop an exhastive search if an idle core is found
Date: Mon, 24 Oct 2022 14:34:35 +0100	[thread overview]
Message-ID: <20221024133435.e2kajx5k7jzznp25@suse.de> (raw)
In-Reply-To: <20221021061558.34767-2-jiahao.os@bytedance.com>

On Fri, Oct 21, 2022 at 02:15:57PM +0800, Hao Jia wrote:
> In update_numa_stats() we try to find an idle cpu on the NUMA node,
> preferably an idle core. When we find an idle core,
> we can stop searching.
> 
> Signed-off-by: Hao Jia <jiahao.os@bytedance.com>
> ---
>  kernel/sched/fair.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index e4a0b8bd941c..b7cbec539c77 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1792,7 +1792,7 @@ static void update_numa_stats(struct task_numa_env *env,
>  		ns->nr_running += rq->cfs.h_nr_running;
>  		ns->compute_capacity += capacity_of(cpu);
>  
> -		if (find_idle && !rq->nr_running && idle_cpu(cpu)) {
> +		if (find_idle && idle_core < 0 && !rq->nr_running && idle_cpu(cpu)) {
>  			if (READ_ONCE(rq->numa_migrate_on) ||
>  			    !cpumask_test_cpu(cpu, env->p->cpus_ptr))
>  				continue;
> @@ -1801,6 +1801,9 @@ static void update_numa_stats(struct task_numa_env *env,
>  				ns->idle_cpu = cpu;
>  
>  			idle_core = numa_idle_core(idle_core, cpu);
> +			/* If we find an idle core, stop searching. */
> +			if (idle_core >= 0)
> +				ns->idle_cpu = idle_core;
>  		}
>  	}
>  	rcu_read_unlock();
> @@ -1808,9 +1811,6 @@ static void update_numa_stats(struct task_numa_env *env,
>  	ns->weight = cpumask_weight(cpumask_of_node(nid));
>  
>  	ns->node_type = numa_classify(env->imbalance_pct, ns);
> -
> -	if (idle_core >= 0)
> -		ns->idle_cpu = idle_core;
>  }
>  

Remove the change in the first hunk and call break in the second hunk
after updating ns->idle_cpu.

-- 
Mel Gorman
SUSE Labs

  reply	other threads:[~2022-10-24 15:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-21  6:15 [PATCH 0/2] Optimize the process of scanning CPU for some functions Hao Jia
2022-10-21  6:15 ` [PATCH 1/2] sched/numa: Stop an exhastive search if an idle core is found Hao Jia
2022-10-24 13:34   ` Mel Gorman [this message]
2022-10-25  3:16     ` [External] " Hao Jia
2022-10-25  9:32       ` Mel Gorman
2022-10-25 11:10         ` Hao Jia
2022-10-25 13:32           ` Mel Gorman
2022-10-26  2:30             ` Hao Jia
2022-10-21  6:15 ` [PATCH 2/2] sched/core: Optimize the order of scanning CPU Hao Jia
2022-10-24 10:00 ` [PATCH 0/2] Optimize the process of scanning CPU for some functions Peter Zijlstra
2022-10-24 12:07   ` [External] " Hao Jia
2022-10-24 13:01   ` Hao Jia

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=20221024133435.e2kajx5k7jzznp25@suse.de \
    --to=mgorman@suse.de \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=jiahao.os@bytedance.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@techsingularity.net \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.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

all inboxes | Powered by JetHome®