mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Wanpeng Li <kernellwp@gmail.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Frederic Weisbecker <frederic@kernel.org>
Subject: Re: [PATCH v2] sched/isolation: Prefer housekeeping cpu in local node
Date: Fri, 21 Jun 2019 08:58:42 +0200	[thread overview]
Message-ID: <20190621065842.GF3436@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1561080911-22655-1-git-send-email-wanpengli@tencent.com>

On Fri, Jun 21, 2019 at 09:35:11AM +0800, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@tencent.com>
> 
> In real product setup, there will be houseeking cpus in each nodes, it 
> is prefer to do housekeeping from local node, fallback to global online 
> cpumask if failed to find houseeking cpu from local node.
> 
> Cc: Ingo Molnar <mingo@redhat.com> 
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Frederic Weisbecker <frederic@kernel.org>
> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>

Looks good; did it actually work? :-)

> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index 63184cf..3d3fb04 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -1726,6 +1726,20 @@ void sched_domains_numa_masks_clear(unsigned int cpu)
>  
>  #endif /* CONFIG_NUMA */


Please double check this function; I wrote it in a hurry :-) Also maybe
add a wee comment on top like:

/*
 * sched_numa_file_closest() - given the NUMA topology, find the cpu
 *                             closest to @cpu from @cpumask.
 * cpumask: cpumask to find a cpu from
 * cpu: cpu to be close to
 *
 * returns: cpu, or >= nr_cpu_ids when nothing found (or !NUMA).
 */

> +int sched_numa_find_closest(const struct cpumask *cpus, int cpu)
> +{
> +#ifdef CONFIG_NUMA
> +	int i, j = cpu_to_node(cpu);
> +
> +	for (i = 0; i < sched_domains_numa_levels; i++) {
> +		cpu = cpumask_any_and(cpus, sched_domains_numa_masks[i][j]);
> +		if (cpu < nr_cpu_ids)
> +			return cpu;
> +	}
> +#endif
> +	return nr_cpu_ids;
> +}

  reply	other threads:[~2019-06-21  6:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-21  1:35 Wanpeng Li
2019-06-21  6:58 ` Peter Zijlstra [this message]
2019-06-21  7:21   ` Wanpeng Li

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=20190621065842.GF3436@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=frederic@kernel.org \
    --cc=kernellwp@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@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®