mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] timer: optimize apply_slack()
@ 2012-03-17 21:31 Felix Fietkau
  2012-03-17 22:06 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Felix Fietkau @ 2012-03-17 21:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: tglx

__fls(mask) is equivalent to find_last_bit(&mask, BITS_PER_LONG), but cheaper.
find_last_bit was showing up high on the list when I was profiling for stalls
on icache misses on a system with very small cache size (MIPS).

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
 kernel/timer.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/timer.c b/kernel/timer.c
index a297ffc..659371e 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -809,7 +809,7 @@ unsigned long apply_slack(struct timer_list *timer, unsigned long expires)
 	if (mask == 0)
 		return expires;
 
-	bit = find_last_bit(&mask, BITS_PER_LONG);
+	bit = __fls(mask);
 
 	mask = (1 << bit) - 1;
 
-- 
1.7.3.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-17 22:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-17 21:31 [PATCH] timer: optimize apply_slack() Felix Fietkau
2012-03-17 22:06 ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®