From: Jemmy Wong <jemmywong512@gmail.com>
To: Tim Chen <tim.c.chen@linux.intel.com>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/3] sched/fair: Rename group_imbalanced to group_pinned_imb
Date: Fri, 2 Oct 2026 23:46:33 +0800 [thread overview]
Message-ID: <20261002154634.71878-3-jemmywong512@gmail.com> (raw)
In-Reply-To: <20261002154634.71878-1-jemmywong512@gmail.com>
The name dates back to the original group_imb heuristic, which flagged
a group when the load difference between its busiest and idlest CPU
exceeded the average task load. Commit 6263322c5e8f ("sched/fair:
Rewrite group_imb trigger") replaced that heuristic: the flag is now
set only when a lower domain fails to balance because tasks are pinned
by cpus_ptr (LBF_SOME_PINNED), and kept while all tasks are pinned
(LBF_ALL_PINNED). The name was carried over unchanged and later became
group_imbalanced in commit 0b0695f2b34a ("sched/fair: Rework
load_balance()").
Today the name no longer matches the condition:
- group_classify() checks group_overloaded first, so a group whose
load really is skewed is usually not classified as imbalanced,
while a flagged group may carry a single extra task.
- calculate_imbalance() does not measure any imbalance for this type;
it moves one task (migrate_task, imbalance = 1).
- Elsewhere in fair.c "imbalance" consistently means the amount of
load to move (env->imbalance, imbalance_pct, calculate_imbalance(),
the lb_imbalance_* schedstats), and imbalanced_active_balance() uses
"imbalanced" for repeated balance failures, unrelated to this flag.
Rename it to group_pinned_imb. The "pinned" prefix names the cause that
raises it, an imbalance the balancer could not fix because tasks are
pinned by cpus_ptr, and distinguishes it from the unqualified
"imbalanced" uses above. The enum is local to fair.c, so no tracepoint,
schedstat or other user-visible interface is affected.
No functional change.
Signed-off-by: Jemmy Wong <jemmywong512@gmail.com>
---
kernel/sched/fair.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index bcb9987952b9..49de871ee7ab 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -10579,7 +10579,7 @@ enum group_type {
* The tasks' affinity constraints previously prevented the scheduler
* from balancing the load across the system.
*/
- group_imbalanced,
+ group_pinned_imb,
/*
* There are tasks running on non-preferred LLC, possible to move
* them to their preferred LLC without creating too much imbalance.
@@ -11938,7 +11938,7 @@ group_type group_classify(unsigned int imbalance_pct,
return group_llc_balance;
if (sg_imbalanced(group))
- return group_imbalanced;
+ return group_pinned_imb;
if (sgs->group_asym_packing)
return group_asym_packing;
@@ -12401,10 +12401,10 @@ static bool update_sd_pick_busiest(struct lb_env *env,
/* Select the group with most tasks preferring dst LLC */
return update_llc_busiest(env, busiest, sgs);
- case group_imbalanced:
+ case group_pinned_imb:
/*
- * Select the 1st imbalanced group as we don't have any way to
- * choose one more than another.
+ * Select the 1st group with pinned tasks as we don't
+ * have any way to choose one more than another.
*/
return false;
@@ -12653,7 +12653,7 @@ static bool update_pick_idlest(struct sched_group *idlest,
break;
case group_llc_balance:
- case group_imbalanced:
+ case group_pinned_imb:
case group_asym_packing:
case group_smt_balance:
/* Those types are not used in the slow wakeup path */
@@ -12786,7 +12786,7 @@ sched_balance_find_dst_group(struct sched_domain *sd, struct task_struct *p, int
break;
case group_llc_balance:
- case group_imbalanced:
+ case group_pinned_imb:
case group_asym_packing:
case group_smt_balance:
/* Those type are not used in the slow wakeup path */
@@ -13049,11 +13049,11 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
}
#endif
- if (busiest->group_type == group_imbalanced) {
+ if (busiest->group_type == group_pinned_imb) {
/*
- * In the group_imb case we cannot rely on group-wide averages
- * to ensure CPU-load equilibrium, try to move any task to fix
- * the imbalance. The next load balance will take care of
+ * In the group_pinned_imb case we cannot rely on group-wide
+ * averages to ensure CPU-load equilibrium, try to move any task
+ * to fix the imbalance. The next load balance will take care of
* balancing back the system.
*/
env->migration_type = migrate_task;
@@ -13184,13 +13184,13 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
/*
* Decision matrix according to the local and busiest group type:
*
- * busiest \ local has_spare fully_busy misfit smt asym imbalanced llc overloaded
+ * busiest \ local has_spare fully_busy misfit smt asym pinned llc overloaded
* has_spare nr_idle balanced N/A N/A N/A balanced N/A balanced
* fully_busy nr_idle nr_idle N/A N/A N/A balanced N/A balanced
* misfit_task force N/A N/A N/A N/A N/A N/A N/A
* smt_balance nr_idle nr_idle N/A N/A N/A balanced N/A balanced
* asym_packing force force N/A N/A N/A force N/A force
- * imbalanced force force N/A N/A N/A force N/A force
+ * pinned_imb force force N/A N/A N/A force N/A force
* llc_balance force nr_idle N/A N/A N/A nr_idle N/A balanced
* overloaded force force N/A N/A N/A force N/A avg_load
*
@@ -13245,11 +13245,11 @@ static struct sched_group *sched_balance_find_src_group(struct lb_env *env)
goto force_balance;
/*
- * If the busiest group is imbalanced the below checks don't
+ * If the busiest group has pinned tasks the below checks don't
* work because they assume all things are equal, which typically
* isn't true due to cpus_ptr constraints and the like.
*/
- if (busiest->group_type == group_imbalanced)
+ if (busiest->group_type == group_pinned_imb)
goto force_balance;
local = &sds.local_stat;
--
2.54.0 (Apple Git-157)
next prev parent reply other threads:[~2026-10-02 15:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 15:46 [PATCH v2 0/3] sched/fair: Update decision matrix and rename pinned-task group state Jemmy Wong
2026-10-02 15:46 ` [PATCH v2 1/3] sched/fair: Add smt_balance and llc_balance to the decision matrix Jemmy Wong
2026-10-02 21:36 ` Tim Chen
2026-10-02 15:46 ` Jemmy Wong [this message]
2026-10-02 15:46 ` [PATCH v2 3/3] sched/fair: Rename sgc->imbalance to sgc->pinned_imb Jemmy Wong
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=20261002154634.71878-3-jemmywong512@gmail.com \
--to=jemmywong512@gmail.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--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 \
/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®