[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5f97134b-71b6-44fb-85fd-5cff6725cf9c@amd.com>
Date: Mon, 27 Oct 2025 10:31:58 +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 02/19] sched/fair: Record per-LLC utilization to guide
cache-aware scheduling decisions
Hello Tim,
On 10/11/2025 11:54 PM, Tim Chen wrote:
> +#ifdef CONFIG_SCHED_CACHE
> +/*
> + * Record the statistics for this scheduler group for later
> + * use. These values guide load balancing on aggregating tasks
> + * to a LLC.
> + */
> +static void record_sg_llc_stats(struct lb_env *env,
> + struct sg_lb_stats *sgs,
> + struct sched_group *group)
> +{
> + /*
> + * Find the child domain on env->dst_cpu. This domain
> + * is either the domain that spans this group(if the
> + * group is a local group), or the sibling domain of
> + * this group.
> + */
> + struct sched_domain *sd = env->sd->child;
Was this intentionally done to limit the update to sg_llc_stats to the
load balancing period of "sd_llc->parent"?
Can't this be done with update_idle_cpu_scan()? I believe it is more
frequent, "sds->total_capacity" from caller gives you the equivalent of
"group_capacity", and "group_util" is already calculated as "sum_util".
Checking "sd_llc->parent" there should be sufficient to check if there
are multiple LLC domains or not. Thoughts?
> + struct sched_domain_shared *sd_share;
> +
> + if (!sched_feat(SCHED_CACHE) || env->idle == CPU_NEWLY_IDLE)
> + return;
> +
> + /* only care about sched domains spanning a LLC */
> + if (sd != rcu_dereference(per_cpu(sd_llc, env->dst_cpu)))
> + return;
> +
> + /*
> + * At this point we know this group spans a LLC domain.
> + * Record the statistic of this group in its corresponding
> + * shared LLC domain.
> + */
> + sd_share = rcu_dereference(per_cpu(sd_llc_shared,
> + cpumask_first(sched_group_span(group))));
> + if (!sd_share)
> + return;
> +
> + if (READ_ONCE(sd_share->util_avg) != sgs->group_util)
> + WRITE_ONCE(sd_share->util_avg, sgs->group_util);
> +
> + if (unlikely(READ_ONCE(sd_share->capacity) != sgs->group_capacity))
> + WRITE_ONCE(sd_share->capacity, sgs->group_capacity);
> +}
--
Thanks and Regards,
Prateek
Powered by blists - more mailing lists