Skip to content

Commit

Permalink
sched: optimize task_new_fair()
Browse files Browse the repository at this point in the history
due to the fact that we no longer keep the 'current' within the tree, 
dequeue/enqueue_entity() is useless for the 'current' in 
task_new_fair(). We are about to reschedule and 
sched_class->put_prev_task() will put the 'current' back into the tree, 
based on its new key.

   text    data     bss     dec     hex filename
  24388    2734      20   27142    6a06 sched.o.before
  24341    2734      20   27095    69d7 sched.o.after

Signed-off-by: Dmitry Adamushko <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Reviewed-by: Thomas Gleixner <[email protected]>
  • Loading branch information
stablebits authored and Ingo Molnar committed Oct 15, 2007
1 parent 75d4ef1 commit 87fefa3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kernel/sched_fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -972,10 +972,11 @@ static void task_new_fair(struct rq *rq, struct task_struct *p)

if (sysctl_sched_child_runs_first &&
curr->vruntime < se->vruntime) {

dequeue_entity(cfs_rq, curr, 0);
/*
* Upon rescheduling, sched_class::put_prev_task() will place
* 'current' within the tree based on its new key value.
*/
swap(curr->vruntime, se->vruntime);
enqueue_entity(cfs_rq, curr, 0);
}

update_stats_enqueue(cfs_rq, se);
Expand Down

0 comments on commit 87fefa3

Please sign in to comment.