sched: optimize task_new_fair()
authorDmitry Adamushko <dmitry.adamushko@gmail.com>
Mon, 15 Oct 2007 15:00:08 +0000 (17:00 +0200)
committerIngo Molnar <mingo@elte.hu>
Mon, 15 Oct 2007 15:00:08 +0000 (17:00 +0200)
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 <dmitry.adamushko@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
kernel/sched_fair.c

index b9e426a8a09fe57976e0cd1d9789c4ed2fb7adc3..827a0636525a36e35ead96313235a54ba143021e 100644 (file)
@@ -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);