Skip to content

Commit

Permalink
sched: Make set_*_buddy() work on non-task entities
Browse files Browse the repository at this point in the history
Make set_*_buddy() work on non-task sched_entity, to facilitate the
use of next_buddy to cache a group entity in cases where one of the
tasks within that entity sleeps or gets preempted.

set_skip_buddy() was incorrectly comparing the policy of task that is
yielding to be not equal to SCHED_IDLE. Yielding should happen even
when task yielding is SCHED_IDLE. This change removes the policy check
on the yielding task.

Signed-off-by: Venkatesh Pallipadi <venki@google.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1302744070-30079-2-git-send-email-venki@google.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Venkatesh Pallipadi authored and Ingo Molnar committed Apr 19, 2011
1 parent 6ddafda commit 69c80f3
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions kernel/sched_fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -1846,26 +1846,26 @@ wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se)

static void set_last_buddy(struct sched_entity *se)
{
if (likely(task_of(se)->policy != SCHED_IDLE)) {
for_each_sched_entity(se)
cfs_rq_of(se)->last = se;
}
if (entity_is_task(se) && unlikely(task_of(se)->policy == SCHED_IDLE))
return;

for_each_sched_entity(se)
cfs_rq_of(se)->last = se;
}

static void set_next_buddy(struct sched_entity *se)
{
if (likely(task_of(se)->policy != SCHED_IDLE)) {
for_each_sched_entity(se)
cfs_rq_of(se)->next = se;
}
if (entity_is_task(se) && unlikely(task_of(se)->policy == SCHED_IDLE))
return;

for_each_sched_entity(se)
cfs_rq_of(se)->next = se;
}

static void set_skip_buddy(struct sched_entity *se)
{
if (likely(task_of(se)->policy != SCHED_IDLE)) {
for_each_sched_entity(se)
cfs_rq_of(se)->skip = se;
}
for_each_sched_entity(se)
cfs_rq_of(se)->skip = se;
}

/*
Expand Down

0 comments on commit 69c80f3

Please sign in to comment.