aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2010-04-28 22:49:36 -0400
committerMatt Turner <mattst88@monolith.freenet-rz.de>2010-05-25 18:40:28 -0400
commita75f5f0f0a3676216e0015b3040c785dbfe1e0da (patch)
treec6cd7600562dd0d374e4d41a1d558ce96ef6c7e2 /arch/alpha
parent1cb3d8e2c8d30d2cbfe42b696d501d0a016edec1 (diff)
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/alpha')
-rw-r--r--arch/alpha/include/asm/bitops.h20
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)
438 438
439/* 439/*
440 * Every architecture must define this function. It's the fastest 440 * Every architecture must define this function. It's the fastest
441 * way of searching a 140-bit bitmap where the first 100 bits are 441 * way of searching a 100-bit bitmap. It's guaranteed that at least
442 * unlikely to be set. It's guaranteed that at least one of the 140 442 * one of the 100 bits is cleared.
443 * bits is set.
444 */ 443 */
445static inline unsigned long 444static inline unsigned long
446sched_find_first_bit(unsigned long b[3]) 445sched_find_first_bit(const unsigned long b[2])
447{ 446{
448 unsigned long b0 = b[0], b1 = b[1], b2 = b[2]; 447 unsigned long b0, b1, ofs, tmp;
449 unsigned long ofs;
450 448
451 ofs = (b1 ? 64 : 128); 449 b0 = b[0];
452 b1 = (b1 ? b1 : b2); 450 b1 = b[1];
453 ofs = (b0 ? 0 : ofs); 451 ofs = (b0 ? 0 : 64);
454 b0 = (b0 ? b0 : b1); 452 tmp = (b0 ? b0 : b1);
455 453
456 return __ffs(b0) + ofs; 454 return __ffs(tmp) + ofs;
457} 455}
458 456
459#include <asm-generic/bitops/ext2-non-atomic.h> 457#include <asm-generic/bitops/ext2-non-atomic.h>