[PATCH] sched: avoid div in rebalance_tick
authorNick Piggin <npiggin@suse.de>
Mon, 12 Feb 2007 08:53:51 +0000 (00:53 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 12 Feb 2007 17:48:37 +0000 (09:48 -0800)
commitff91691bccdb741efb2df0489058a4961fa79598
treeeeef6ce3d48df86a7b2c1178a9ba54210b8b8981
parent0a9ac38246b11892ad20a1eb9deb67adf8c0db2f
[PATCH] sched: avoid div in rebalance_tick

Avoid expensive integer divide 3 times per CPU per tick.

A userspace test of this loop went from 26ns, down to 19ns on a G5; and
from 123ns down to 28ns on a P3.

(Also avoid a variable bit shift, as suggested by Alan. The effect
of this wasn't noticable on the CPUs I tested with).

Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/sched.c