Skip to content

Commit b34cb07

Browse files
auldpPeter Zijlstra
authored andcommitted
sched/fair: Fix enqueue_task_fair() warning some more
sched/fair: Fix enqueue_task_fair warning some more The recent patch, fe61468 (sched/fair: Fix enqueue_task_fair warning) did not fully resolve the issues with the rq->tmp_alone_branch != &rq->leaf_cfs_rq_list warning in enqueue_task_fair. There is a case where the first for_each_sched_entity loop exits due to on_rq, having incompletely updated the list. In this case the second for_each_sched_entity loop can further modify se. The later code to fix up the list management fails to do what is needed because se does not point to the sched_entity which broke out of the first loop. The list is not fixed up because the throttled parent was already added back to the list by a task enqueue in a parallel child hierarchy. Address this by calling list_add_leaf_cfs_rq if there are throttled parents while doing the second for_each_sched_entity loop. Fixes: fe61468 ("sched/fair: Fix enqueue_task_fair warning") Suggested-by: Vincent Guittot <[email protected]> Signed-off-by: Phil Auld <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Dietmar Eggemann <[email protected]> Reviewed-by: Vincent Guittot <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent b9bbe6e commit b34cb07

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

kernel/sched/fair.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5479,6 +5479,13 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
54795479
/* end evaluation on encountering a throttled cfs_rq */
54805480
if (cfs_rq_throttled(cfs_rq))
54815481
goto enqueue_throttle;
5482+
5483+
/*
5484+
* One parent has been throttled and cfs_rq removed from the
5485+
* list. Add it back to not break the leaf list.
5486+
*/
5487+
if (throttled_hierarchy(cfs_rq))
5488+
list_add_leaf_cfs_rq(cfs_rq);
54825489
}
54835490

54845491
enqueue_throttle:

0 commit comments

Comments
 (0)