From: Jemmy Wong <jemmywong512@gmail.com>
To: 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>,
Tim Chen <tim.c.chen@linux.intel.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] sched/fair: Rename sgc->imbalance to sgc->pinned_task
Date: Mon, 28 Sep 2026 12:20:18 +0800 [thread overview]
Message-ID: <20260928042018.10618-4-jemmywong512@gmail.com> (raw)
In-Reply-To: <20260928042018.10618-1-jemmywong512@gmail.com>
sgc->imbalance does not describe a load skew either. It is set only
when a child domain failed to balance because some tasks were pinned by
cpus_ptr, and the parent then classifies the group as group_pinned_task
so that it can force a migration.
The old name also collides with env->imbalance, the amount of load
still to move, and with imbalance_pct. And after the previous rename,
sg_imbalanced() returns group_pinned_task, so the helper and the group
type no longer agree.
Rename the field to pinned_task and its reader to sg_pinned_task().
No functional change.
Signed-off-by: Jemmy Wong <jemmywong512@gmail.com>
---
kernel/sched/fair.c | 24 ++++++++++++------------
kernel/sched/sched.h | 6 +++++-
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index aa63950976aa..43bdca636461 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -11595,7 +11595,7 @@ static inline bool check_misfit_status(struct rq *rq)
}
/*
- * Group imbalance indicates (and tries to solve) the problem where balancing
+ * sgc->pinned_task indicates (and tries to solve) the problem where balancing
* groups is inadequate due to ->cpus_ptr constraints.
*
* Imagine a situation of two groups of 4 CPUs each and 4 tasks each with a
@@ -11623,9 +11623,9 @@ static inline bool check_misfit_status(struct rq *rq)
* subtle and fragile situation.
*/
-static inline int sg_imbalanced(struct sched_group *group)
+static inline int sg_pinned_task(struct sched_group *group)
{
- return group->sgc->imbalance;
+ return group->sgc->pinned_task;
}
/*
@@ -11700,7 +11700,7 @@ group_type group_classify(unsigned int imbalance_pct,
if (sgs->group_llc_balance)
return group_llc_balance;
- if (sg_imbalanced(group))
+ if (sg_pinned_task(group))
return group_pinned_task;
if (sgs->group_asym_packing)
@@ -13619,10 +13619,10 @@ static int sched_balance_rq(int this_cpu, struct rq *this_rq,
* We failed to reach balance because of affinity.
*/
if (sd_parent) {
- int *group_imbalance = &sd_parent->groups->sgc->imbalance;
+ int *pinned_task = &sd_parent->groups->sgc->pinned_task;
if ((env.flags & LBF_SOME_PINNED) && env.imbalance > 0)
- *group_imbalance = 1;
+ *pinned_task = 1;
}
/* All tasks on this runqueue were pinned by CPU affinity */
@@ -13722,21 +13722,21 @@ static int sched_balance_rq(int this_cpu, struct rq *this_rq,
out_balanced:
/*
* We reach balance although we may have faced some affinity
- * constraints. Clear the imbalance flag only if other tasks got
+ * constraints. Clear the pinned flag only if other tasks got
* a chance to move and fix the imbalance.
*/
if (sd_parent && !(env.flags & LBF_ALL_PINNED)) {
- int *group_imbalance = &sd_parent->groups->sgc->imbalance;
+ int *pinned_task = &sd_parent->groups->sgc->pinned_task;
- if (*group_imbalance)
- *group_imbalance = 0;
+ if (*pinned_task)
+ *pinned_task = 0;
}
out_all_pinned:
/*
* We reach balance because all tasks are pinned at this level so
- * we can't migrate them. Let the imbalance flag set so parent level
- * can try to migrate them.
+ * we can't migrate them. Let the pinned flag stay set so the parent
+ * level can try to migrate them.
*/
schedstat_inc(sd->lb_balanced[idle]);
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index e656c7059bf8..b64966dde395 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2257,7 +2257,11 @@ struct sched_group_capacity {
unsigned long min_capacity; /* Min per-CPU capacity in group */
unsigned long max_capacity; /* Max per-CPU capacity in group */
unsigned long next_update;
- int imbalance; /* XXX unrelated to capacity but shared group state */
+ /*
+ * Set when a child domain cannot balance pinned tasks.
+ * XXX unrelated to capacity, but it is shared group state.
+ */
+ int pinned_task;
int id;
--
2.54.0 (Apple Git-157)
prev parent reply other threads:[~2026-09-28 4:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 4:20 [PATCH 0/3] sched/fair: Update decision matrix and rename pinned-task group state Jemmy Wong
2026-09-28 4:20 ` [PATCH 1/3] sched/fair: Add smt_balance and llc_balance to the decision matrix Jemmy Wong
2026-09-28 4:20 ` [PATCH 2/3] sched/fair: Rename group_imbalanced to group_pinned_task Jemmy Wong
2026-09-28 4:20 ` Jemmy Wong [this message]
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=20260928042018.10618-4-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®