Re: [PATCH 2/3] sched/fair: Rename group_imbalanced to group_pinned_task
From: Tim Chen
Date: Thu Oct 01 2026 - 17:55:11 EST
On Mon, 2026-09-28 at 12:20 +0800, Jemmy Wong wrote:
> 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_task, which describes the condition that
> raises it and follows the adjective_noun pattern of group_misfit_task.
> 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@xxxxxxxxx>
> ---
> 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 f9ddcecfd19d..aa63950976aa 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -10363,7 +10363,7 @@ enum group_type {
> * The tasks' affinity constraints previously prevented the scheduler
> * from balancing the load across the system.
> */
> - group_imbalanced,
> + group_pinned_task,
I believe we are trying to fix imbalance due to pinned tasks.
Perhaps group_pinned_imbalance is more descriptive.
Tim