Skip to content

Commit

Permalink
sched: remove do_div() from __sched_slice()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Jan 25, 2008
1 parent 5d2f5a6 commit 4bf0b77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/sched_fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4bf0b77

Please sign in to comment.