From: Jianyong Wu <wujianyong@hygon.cn>
To: Tim Chen <tim.c.chen@linux.intel.com>,
"mingo@redhat.com" <mingo@redhat.com>,
"peterz@infradead.org" <peterz@infradead.org>,
"juri.lelli@redhat.com" <juri.lelli@redhat.com>,
"vincent.guittot@linaro.org" <vincent.guittot@linaro.org>,
"yu.c.chen@intel.com" <yu.c.chen@intel.com>
Cc: "dietmar.eggemann@arm.com" <dietmar.eggemann@arm.com>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
"bsegall@google.com" <bsegall@google.com>,
"mgorman@suse.de" <mgorman@suse.de>,
"vschneid@redhat.com" <vschneid@redhat.com>,
"kprateek.nayak@amd.com" <kprateek.nayak@amd.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"jianyong.wu@outlook.com" <jianyong.wu@outlook.com>,
Yibin Liu <liuyibin@hygon.cn>, Yuan Zhong <zhongyuan@hygon.cn>
Subject: RE: [PATCH] sched/cache: Fix group_llc_balance being unreachable above the first NUMA level
Date: Thu, 5 Nov 2026 02:48:26 +0000 [thread overview]
Message-ID: <e2c8b992aa8d4437b57d11f77c6465fe@hygon.cn> (raw)
In-Reply-To: <5b9e949a64935bc280ae72b3acea80745a5600f3.camel@linux.intel.com>
Hi Tim,
> So we do not do the llc_balance check for non cache aware scheduling
> case.
>
Thanks, this is clearer than my version, and cheaper too: when cache aware
scheduling is disabled the group type check is either compiled out or skipped
by the static branch.
This patch comes from my earlier series that scales cache aware scheduling at
LLC granularity. Yibin found that without it mainline does not pull a task
back into its preferred LLC once the task sits beyond the first NUMA level, so
I picked it out and sent it as a standalone fix.
I'll include your version in v2.
Thanks
Jianyong
> Tim
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index cfc982205b98..8a7442189a3b 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -12192,6 +12192,16 @@ static bool update_llc_busiest(struct lb_env
> *env,
> */
> return sgs->nr_pref_dst_llc > busiest->nr_pref_dst_llc;
> }
> +
> +/*
> + * The busiest group has tasks that prefer the destination LLC and
> + * cache aware scheduling is enabled.
> + */
> +static inline bool busiest_llc_balance(struct sg_lb_stats *busiest)
> +{
> + return sched_cache_enabled() &&
> + busiest->group_type == group_llc_balance;
> +}
> #else
> static inline void record_sg_llc_stats(struct lb_env *env, struct sg_lb_stats
> *sgs,
> struct sched_group *group)
> @@ -12210,6 +12220,11 @@ static bool update_llc_busiest(struct lb_env
> *env,
> {
> return false;
> }
> +
> +static inline bool busiest_llc_balance(struct sg_lb_stats *busiest)
> +{
> + return false;
> +}
> #endif
>
> /**
> @@ -13303,14 +13318,25 @@ static struct sched_group
> *sched_balance_find_src_group(struct lb_env *env)
> goto out_balanced;
> }
>
> - /*
> - * Try to move all excess tasks to a sibling domain of the busiest
> - * group's child domain.
> - */
> - if (sds.prefer_sibling && local->group_type == group_has_spare
> &&
> - (busiest->group_type == group_llc_balance ||
> - sibling_imbalance(env, &sds, busiest, local) > 1))
> - goto force_balance;
> + if (local->group_type == group_has_spare) {
> +
> + if (busiest_llc_balance(busiest))
> + goto force_balance;
> +
> + /*
> + * Try to move all excess tasks to a sibling domain of
> the
> + * busiest group's child domain.
> + */
> + if (sds.prefer_sibling &&
> + sibling_imbalance(env, &sds, busiest, local) > 1)
> + goto force_balance;
> + }
>
>
> >
> > Fixes: f38cc2f0d8a3 ("sched/cache: Prioritize tasks preferring destination
> LLC during balancing")
> > Reported-by: Yibin Liu <liuyibin@hygon.cn>
> > Signed-off-by: Jianyong Wu <wujianyong@hygon.cn>
> > ---
> > kernel/sched/fair.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 57360f5cdde4..205a0891b0a0 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -13294,9 +13294,10 @@ static struct sched_group
> *sched_balance_find_src_group(struct lb_env *env)
> > * Try to move all excess tasks to a sibling domain of the busiest
> > * group's child domain.
> > */
> > - if (sds.prefer_sibling && local->group_type == group_has_spare &&
> > + if (local->group_type == group_has_spare &&
> > (busiest->group_type == group_llc_balance ||
> > - sibling_imbalance(env, &sds, busiest, local) > 1))
> > + (sds.prefer_sibling &&
> > + sibling_imbalance(env, &sds, busiest, local) > 1)))
> > goto force_balance;
> >
> > if (busiest->group_type != group_overloaded) {
next prev parent reply other threads:[~2026-11-05 2:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 14:13 Jianyong Wu
2026-11-04 19:02 ` Tim Chen
2026-11-05 2:48 ` Jianyong Wu [this message]
2026-11-05 3:04 ` Chen Yu
2026-11-05 4:50 ` Jianyong Wu
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=e2c8b992aa8d4437b57d11f77c6465fe@hygon.cn \
--to=wujianyong@hygon.cn \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=jianyong.wu@outlook.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyibin@hygon.cn \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tim.c.chen@linux.intel.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=yu.c.chen@intel.com \
--cc=zhongyuan@hygon.cn \
/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®