sched: simplify sched_slice()
authorIngo Molnar <mingo@elte.hu>
Fri, 14 Mar 2008 21:17:08 +0000 (22:17 +0100)
committerIngo Molnar <mingo@elte.hu>
Sat, 15 Mar 2008 02:02:50 +0000 (03:02 +0100)
Use the existing calc_delta_mine() calculation for sched_slice(). This
saves a divide and simplifies the code because we share it with the
other /cfs_rq->load users.

It also improves code size:

      text    data     bss     dec     hex filename
     42659    2740     144   45543    b1e7 sched.o.before
     42093    2740     144   44977    afb1 sched.o.after

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
kernel/sched_fair.c

index 31aa1b9fa7623e15c51dab79b8eee0a1b34c110f..f2cc59080efa4f9ae1e12aa30afe2e3fe08a86f9 100644 (file)
@@ -283,12 +283,8 @@ static u64 __sched_period(unsigned long nr_running)
  */
 static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
-       u64 slice = __sched_period(cfs_rq->nr_running);
-
-       slice *= se->load.weight;
-       do_div(slice, cfs_rq->load.weight);
-
-       return slice;
+       return calc_delta_mine(__sched_period(cfs_rq->nr_running),
+                              se->load.weight, &cfs_rq->load);
 }
 
 /*