Skip to content

Commit f01ae9c

Browse files
koct9igregkh
authored andcommitted
sched/fair: Do not announce throttled next buddy in dequeue_task_fair()
commit 754bd598be9bbc953bc709a9e8ed7f3188bfb9d7 upstream. Hierarchy could be already throttled at this point. Throttled next buddy could trigger a NULL pointer dereference in pick_next_task_fair(). Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Ben Segall <bsegall@google.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/146608183552.21905.15924473394414832071.stgit@buzz Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Ben Pineau <benjamin.pineau@mirakl.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ae3d7b8 commit f01ae9c

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

kernel/sched/fair.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4233,15 +4233,14 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags)
42334233

42344234
/* Don't dequeue parent if it has other entities besides us */
42354235
if (cfs_rq->load.weight) {
4236+
/* Avoid re-evaluating load for this entity: */
4237+
se = parent_entity(se);
42364238
/*
42374239
* Bias pick_next to pick a task from this cfs_rq, as
42384240
* p is sleeping when it is within its sched_slice.
42394241
*/
4240-
if (task_sleep && parent_entity(se))
4241-
set_next_buddy(parent_entity(se));
4242-
4243-
/* avoid re-evaluating load for this entity */
4244-
se = parent_entity(se);
4242+
if (task_sleep && se && !throttled_hierarchy(cfs_rq))
4243+
set_next_buddy(se);
42454244
break;
42464245
}
42474246
flags |= DEQUEUE_SLEEP;

0 commit comments

Comments
 (0)