[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250923074430.1086729-1-sieberf@amazon.com>
Date: Tue, 23 Sep 2025 09:44:29 +0200
From: Fernand Sieber <sieberf@...zon.com>
To: K Prateek Nayak <kprateek.nayak@....com>
CC: <mingo@...hat.com>, <peterz@...radead.org>,
<linux-kernel@...r.kernel.org>, <juri.lelli@...hat.com>,
<vincent.guittot@...aro.org>, <dietmar.eggemann@....com>,
<rostedt@...dmis.org>, <bsegall@...gle.com>, <mgorman@...e.de>,
<bristot@...hat.com>, <vschneid@...hat.com>, <dwmw@...zon.co.uk>,
<jschoenh@...zon.de>, <liuyuxua@...zon.com>
Subject: Re: [PATCH 2/4] sched/fair: Still look for the idlest cpu with no matching cookie
On 9/23/2025 9:32 AM, Fernand Sieber wrote:
> Hey Prateek. Thanks for the catch. I'll fix as follows for next rev:
>
> +/*
> + * sched_balance_find_dst_group_cpu - find the idlest CPU among the CPUs in the group.
> + */
> +static inline int
> +sched_balance_find_dst_group_cpu(struct sched_group *group, struct task_struct *p, int this_cpu)
> +{
> + int cpu = __sched_balance_find_dst_group_cpu(group, p, -1, true);
> + return cpu >= 0 ? cpu : __sched_balance_find_dst_group_cpu(group, p, this_cpu, false);
> +}
On second thoughts, this doesn't work as it breaks the original fallback path.
A better modification would be this:
@@ -7341,7 +7341,7 @@ __sched_balance_find_dst_group_cpu(struct sched_group *group, struct task_struct
unsigned long load, min_load = ULONG_MAX;
unsigned int min_exit_latency = UINT_MAX;
u64 latest_idle_timestamp = 0;
- int least_loaded_cpu = this_cpu;
+ int least_loaded_cpu = -1;
int shallowest_idle_cpu = -1;
int i;
@@ -7357,6 +7357,9 @@ __sched_balance_find_dst_group_cpu(struct sched_group *group, struct task_struct
if (cookie_match ^ sched_core_cookie_match(rq, p))
continue;
+ if (least_loaded_cpu < 0)
+ least_loaded_cpu = this_cpu;
+
if (sched_idle_cpu(i))
return i;
Thanks,
Fernand
Amazon Development Centre (South Africa) (Proprietary) Limited
29 Gogosoa Street, Observatory, Cape Town, Western Cape, 7925, South Africa
Registration Number: 2004 / 034463 / 07
Powered by blists - more mailing lists