mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Waiman Long <llong@redhat.com>
To: Phil Auld <pauld@redhat.com>, linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Frederic Weisbecker <frederic@kernel.org>
Subject: Re: [PATCH] sched/isolation: Make use of more than one housekeeping cpu
Date: Tue, 11 Feb 2025 09:24:25 -0500	[thread overview]
Message-ID: <ffd19f47-dbbb-4b04-82f7-d858b2d0ed64@redhat.com> (raw)
In-Reply-To: <20250211141437.GA349314@pauld.westford.csb>

On 2/11/25 9:14 AM, Phil Auld wrote:
> Oops, sorry... meant "[PATCH]"
>
> On Tue, Feb 11, 2025 at 02:01:04PM +0000 Phil Auld wrote:
>> The exising code uses housekeeping_any_cpu() to select a cpu for
>> a given housekeeping task. However, this often ends up calling
>> cpumask_any_and() which is defined as cpumask_first_and() which has
>> the effect of alyways using the first cpu among those available.
>>
>> The same applies when multiple NUMA nodes are involved. In that
>> case the first cpu in the local node is chosen which does provide
>> a bit of spreading but with multiple HK cpus per node the same
>> issues arise.
>>
>> Spread the HK work out by having housekeeping_any_cpu() and
>> sched_numa_find_closest() use cpumask_any_and_distribute()
>> instead of cpumask_any_and().
>>
>> Signed-off-by: Phil Auld <pauld@redhat.com>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Cc: Juri Lelli <juri.lelli@redhat.com>
>> Cc: Frederic Weisbecker <frederic@kernel.org>
>> Cc: Waiman Long <longman@redhat.com>
>> Cc: linux-kernel@vger.kernel.org
>> ---
>>   kernel/sched/isolation.c | 2 +-
>>   kernel/sched/topology.c  | 2 +-
>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
>> index 81bc8b329ef1..93b038d48900 100644
>> --- a/kernel/sched/isolation.c
>> +++ b/kernel/sched/isolation.c
>> @@ -40,7 +40,7 @@ int housekeeping_any_cpu(enum hk_type type)
>>   			if (cpu < nr_cpu_ids)
>>   				return cpu;
>>   
>> -			cpu = cpumask_any_and(housekeeping.cpumasks[type], cpu_online_mask);
>> +			cpu = cpumask_any_and_distribute(housekeeping.cpumasks[type], cpu_online_mask);
>>   			if (likely(cpu < nr_cpu_ids))
>>   				return cpu;
>>   			/*
>> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
>> index c49aea8c1025..94133f843485 100644
>> --- a/kernel/sched/topology.c
>> +++ b/kernel/sched/topology.c
>> @@ -2101,7 +2101,7 @@ int sched_numa_find_closest(const struct cpumask *cpus, int cpu)
>>   	for (i = 0; i < sched_domains_numa_levels; i++) {
>>   		if (!masks[i][j])
>>   			break;
>> -		cpu = cpumask_any_and(cpus, masks[i][j]);
>> +		cpu = cpumask_any_and_distribute(cpus, masks[i][j]);
>>   		if (cpu < nr_cpu_ids) {
>>   			found = cpu;
>>   			break;
>> -- 
>> 2.47.1
>>
>>
LGTM

Reviewed-by: Waiman Long <longman@redhat.com>


  reply	other threads:[~2025-02-11 14:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-11 14:01 [CHANGE 1/2] " Phil Auld
2025-02-11 14:14 ` [PATCH] " Phil Auld
2025-02-11 14:24   ` Waiman Long [this message]
2025-02-13  4:44 ` [CHANGE 1/2] " Madadi Vineeth Reddy
2025-02-13 14:26   ` Phil Auld
2025-02-14  5:38     ` Vishal Chourasia
2025-02-18 15:00       ` Phil Auld
2025-02-18 15:23         ` Waiman Long
2025-02-18 15:30           ` Phil Auld
2025-02-18 15:33             ` Waiman Long
2025-02-20  9:20         ` Vishal Chourasia
2025-02-20 15:52           ` Phil Auld
2025-02-21  4:42             ` Vishal Chourasia

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=ffd19f47-dbbb-4b04-82f7-d858b2d0ed64@redhat.com \
    --to=llong@redhat.com \
    --cc=frederic@kernel.org \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pauld@redhat.com \
    --cc=peterz@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 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®