diff options
author | Matt Turner <mattst88@gmail.com> | 2010-04-28 22:49:36 -0400 |
---|---|---|
committer | Matt Turner <mattst88@monolith.freenet-rz.de> | 2010-05-26 00:40:28 +0200 |
commit | a75f5f0f0a3676216e0015b3040c785dbfe1e0da (patch) | |
tree | c6cd7600562dd0d374e4d41a1d558ce96ef6c7e2 /arch | |
parent | 1cb3d8e2c8d30d2cbfe42b696d501d0a016edec1 (diff) | |
download | linux-a75f5f0f0a3676216e0015b3040c785dbfe1e0da.tar.gz linux-a75f5f0f0a3676216e0015b3040c785dbfe1e0da.tar.bz2 linux-a75f5f0f0a3676216e0015b3040c785dbfe1e0da.zip |
alpha: simplify and optimize sched_find_first_bit
Search only the first 100 bits instead of 140, saving a couple
instructions. The resulting code is about 1/3 faster (40K ticks/1000
iterations down to 30K ticks/1000 iterations).
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: linux-alpha@vger.kernel.org
Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/include/asm/bitops.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/arch/alpha/include/asm/bitops.h b/arch/alpha/include/asm/bitops.h index 296da1d5ed57..1dce24bc455a 100644 --- a/arch/alpha/include/asm/bitops.h +++ b/arch/alpha/include/asm/bitops.h @@ -438,22 +438,20 @@ static inline unsigned int __arch_hweight8(unsigned int w) /* * Every architecture must define this function. It's the fastest - * way of searching a 140-bit bitmap where the first 100 bits are - * unlikely to be set. It's guaranteed that at least one of the 140 - * bits is set. + * way of searching a 100-bit bitmap. It's guaranteed that at least + * one of the 100 bits is cleared. */ static inline unsigned long -sched_find_first_bit(unsigned long b[3]) +sched_find_first_bit(const unsigned long b[2]) { - unsigned long b0 = b[0], b1 = b[1], b2 = b[2]; - unsigned long ofs; + unsigned long b0, b1, ofs, tmp; - ofs = (b1 ? 64 : 128); - b1 = (b1 ? b1 : b2); - ofs = (b0 ? 0 : ofs); - b0 = (b0 ? b0 : b1); + b0 = b[0]; + b1 = b[1]; + ofs = (b0 ? 0 : 64); + tmp = (b0 ? b0 : b1); - return __ffs(b0) + ofs; + return __ffs(tmp) + ofs; } #include <asm-generic/bitops/ext2-non-atomic.h> |