[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5badc525-f745-452d-b2ae-1f58d5271aae@intel.com>
Date: Thu, 16 Oct 2025 00:03:55 +0800
From: "Chen, Yu C" <yu.c.chen@...el.com>
To: Peter Zijlstra <peterz@...radead.org>, Tim Chen
<tim.c.chen@...ux.intel.com>
CC: Ingo Molnar <mingo@...hat.com>, K Prateek Nayak <kprateek.nayak@....com>,
"Gautham R . Shenoy" <gautham.shenoy@....com>, Vincent Guittot
<vincent.guittot@...aro.org>, Juri Lelli <juri.lelli@...hat.com>, "Dietmar
Eggemann" <dietmar.eggemann@....com>, Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>, "Valentin
Schneider" <vschneid@...hat.com>, Madadi Vineeth Reddy
<vineethr@...ux.ibm.com>, Hillf Danton <hdanton@...a.com>, Shrikanth Hegde
<sshegde@...ux.ibm.com>, Jianyong Wu <jianyong.wu@...look.com>, Yangyu Chen
<cyy@...self.name>, Tingyin Duan <tingyin.duan@...il.com>, Vern Hao
<vernhao@...cent.com>, Len Brown <len.brown@...el.com>, Aubrey Li
<aubrey.li@...el.com>, Zhao Liu <zhao1.liu@...el.com>, Chen Yu
<yu.chen.surf@...il.com>, Libo Chen <libo.chen@...cle.com>, Adam Li
<adamli@...amperecomputing.com>, Tim Chen <tim.c.chen@...el.com>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 10/19] sched/fair: Prioritize tasks preferring destination
LLC during balancing
On 10/15/2025 11:10 PM, Peter Zijlstra wrote:
> On Sat, Oct 11, 2025 at 11:24:47AM -0700, Tim Chen wrote:
>
>> +static inline bool llc_balance(struct lb_env *env, struct sg_lb_stats *sgs,
>> + struct sched_group *group)
>> +{
>> + struct sched_domain *child = env->sd->child;
>> + int llc;
>> +
>> + if (!sched_cache_enabled())
>> + return false;
>> +
>> + if (env->sd->flags & SD_SHARE_LLC)
>> + return false;
>> +
>> + /* only care about task migration among LLCs */
>> + if (child && !(child->flags & SD_SHARE_LLC))
>> + return false;
>> +
>> + llc = llc_idx(env->dst_cpu);
>> + if (sgs->nr_pref_llc[llc] > 0 &&
>
> Robot says llc can be -1 here, and it don't like doing out of bound
> array access.
>
Humm, there seems to be a race condition during bootup with
build_sched_domains(),
where the per-cpu(sd_llc_idx) is reset to -1 at the beginning. We might
need to add a sanity check here.
thanks,
Chenyu
>> + can_migrate_llc(env->src_cpu, env->dst_cpu, 0, true) == mig_llc)
>> + return true;
>> +
>> + return false;
>> +}
Powered by blists - more mailing lists