[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7ff17661-05fe-4137-b7e1-c799fe318c9f@amd.com>
Date: Mon, 27 Oct 2025 11:12:07 +0530
From: K Prateek Nayak <kprateek.nayak@....com>
To: Tim Chen <tim.c.chen@...ux.intel.com>, Peter Zijlstra
<peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, "Gautham R . Shenoy"
<gautham.shenoy@....com>
CC: Chen Yu <yu.c.chen@...el.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 04/19] sched/fair: Introduce a static key to enable cache
aware only for multi LLCs
Hello Tim,
On 10/11/2025 11:54 PM, Tim Chen wrote:
> @@ -2530,10 +2531,12 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
> * between LLCs and memory channels.
> */
> nr_llcs = sd->span_weight / child->span_weight;
> - if (nr_llcs == 1)
> + if (nr_llcs == 1) {
> imb = sd->span_weight >> 3;
> - else
> + } else {
> imb = nr_llcs;
> + has_multi_llcs = true;
One caution: this will not hold if all the CPUs aren't online during boot.
One case I can think of is when the kernel is booted with "maxcpus" cmdline
and CPUs are hotplugged later.
Unfortunately, I don't think we even have the raw topology data from the
arch/ side under such scenario to accurately make a call if the system
contains single or multiple LLC :(
I'm not sure if it is feasible but assuming the task_work() cannot run if
&sched_cache_allowed is false, can the fist instance of the task work for
sched_cache do the necessary setup?
> + }
> imb = max(1U, imb);
> sd->imb_numa_nr = imb;
>
> @@ -2581,6 +2584,13 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
> if (has_cluster)
> static_branch_inc_cpuslocked(&sched_cluster_active);
>
> +#ifdef CONFIG_SCHED_CACHE
> + if (has_multi_llcs) {
> + static_branch_enable_cpuslocked(&sched_cache_allowed);
> + pr_info("Cache aware load balance enabled.\n");
> + }
> +#endif
> +
> if (rq && sched_debug_verbose)
> pr_info("root domain span: %*pbl\n", cpumask_pr_args(cpu_map));
>
--
Thanks and Regards,
Prateek
Powered by blists - more mailing lists