Skip to content

Commit 7ed735c

Browse files
vingu-linaroPeter Zijlstra
authored andcommitted
sched/fair: Fix find_idlest_group() to handle CPU affinity
Because of CPU affinity, the local group can be skipped which breaks the assumption that statistics are always collected for local group. With uninitialized local_sgs, the comparison is meaningless and the behavior unpredictable. This can even end up to use local pointer which is to NULL in this case. If the local group has been skipped because of CPU affinity, we return the idlest group. Fixes: 57abff0 ("sched/fair: Rework find_idlest_group()") Reported-by: John Stultz <[email protected]> Signed-off-by: Vincent Guittot <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Valentin Schneider <[email protected]> Tested-by: John Stultz <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
1 parent c346695 commit 7ed735c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

kernel/sched/fair.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8417,6 +8417,10 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p,
84178417
if (!idlest)
84188418
return NULL;
84198419

8420+
/* The local group has been skipped because of CPU affinity */
8421+
if (!local)
8422+
return idlest;
8423+
84208424
/*
84218425
* If the local group is idler than the selected idlest group
84228426
* don't try and push the task.

0 commit comments

Comments
 (0)