Skip to content

Commit

Permalink
sched/fair: Fix clearing of has_idle_cores flag in select_idle_cpu()
Browse files Browse the repository at this point in the history
In commit:

  9fe1f12 ("sched/fair: Merge select_idle_core/cpu()")

in select_idle_cpu(), we check if an idle core is present in the LLC
of the target CPU via the flag "has_idle_cores". We look for the idle
core in select_idle_cores(). If select_idle_cores() isn't able to find
an idle core/CPU, we need to unset the has_idle_cores flag in the LLC
of the target to prevent other CPUs from going down this route.

However, the current code is unsetting it in the LLC of the current
CPU instead of the target CPU. This patch fixes this issue.

Fixes: 9fe1f12 ("sched/fair: Merge select_idle_core/cpu()")
Signed-off-by: Gautham R. Shenoy <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Reviewed-by: Vincent Guittot <[email protected]>
Reviewed-by: Srikar Dronamraju <[email protected]>
Acked-by: Mel Gorman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
Gautham R. Shenoy authored and Ingo Molnar committed May 12, 2021
1 parent 88b0639 commit 02dbb72
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -6217,7 +6217,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, bool
}

if (has_idle_core)
set_idle_cores(this, false);
set_idle_cores(target, false);

if (sched_feat(SIS_PROP) && !has_idle_core) {
time = cpu_clock(this) - time;
Expand Down

0 comments on commit 02dbb72

Please sign in to comment.