]> err.no Git - linux-2.6/commitdiff
sched: remove do_div() from __sched_slice()
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Fri, 25 Jan 2008 20:08:21 +0000 (21:08 +0100)
committerIngo Molnar <mingo@elte.hu>
Fri, 25 Jan 2008 20:08:21 +0000 (21:08 +0100)
Yanmin Zhang noticed a nice optimization:

  p = l * nr / nl, nl = l/g -> p = g * nr

which eliminates a do_div() from __sched_period().

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

index 2208692dc4a004714d02f27a6579e74fa71d52ef..10aa6e1ae3ddebdf9915f7fa69d29a11c183b234 100644 (file)
@@ -248,8 +248,8 @@ static u64 __sched_period(unsigned long nr_running)
        unsigned long nr_latency = sched_nr_latency;
 
        if (unlikely(nr_running > nr_latency)) {
+               period = sysctl_sched_min_granularity;
                period *= nr_running;
-               do_div(period, nr_latency);
        }
 
        return period;