From: Peter Zijlstra Date: Fri, 25 Jan 2008 20:08:21 +0000 (+0100) Subject: sched: remove do_div() from __sched_slice() X-Git-Tag: v2.6.25-rc1~1237^2~43 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bf0b77158d581c952af237aec79d0604b78fe27;p=linux-2.6 sched: remove do_div() from __sched_slice() 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 Signed-off-by: Ingo Molnar --- diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 2208692dc4..10aa6e1ae3 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c @@ -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;