Commit 02479099 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

sched: fix buddies for group scheduling

Impact: scheduling order fix for group scheduling

For each level in the hierarchy, set the buddy to point to the right entity.
Therefore, when we do the hierarchical schedule, we have a fair chance of
ending up where we meant to.
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: default avatarMike Galbraith <efault@gmx.de>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 4793241b
...@@ -1319,6 +1319,18 @@ wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se) ...@@ -1319,6 +1319,18 @@ wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se)
return 0; return 0;
} }
static void set_last_buddy(struct sched_entity *se)
{
for_each_sched_entity(se)
cfs_rq_of(se)->last = se;
}
static void set_next_buddy(struct sched_entity *se)
{
for_each_sched_entity(se)
cfs_rq_of(se)->next = se;
}
/* /*
* Preempt the current task with a newly woken task if needed: * Preempt the current task with a newly woken task if needed:
*/ */
...@@ -1352,8 +1364,8 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync) ...@@ -1352,8 +1364,8 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync)
* obvious reasons its a bad idea to schedule back to the idle thread. * obvious reasons its a bad idea to schedule back to the idle thread.
*/ */
if (sched_feat(LAST_BUDDY) && likely(se->on_rq && curr != rq->idle)) if (sched_feat(LAST_BUDDY) && likely(se->on_rq && curr != rq->idle))
cfs_rq_of(se)->last = se; set_last_buddy(se);
cfs_rq_of(pse)->next = pse; set_next_buddy(pse);
/* /*
* We can come here with TIF_NEED_RESCHED already set from new task * We can come here with TIF_NEED_RESCHED already set from new task
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment