lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1332022014.9397.2.camel@edumazet-glaptop>
Date:	Sat, 17 Mar 2012 15:06:54 -0700
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Felix Fietkau <nbd@...nwrt.org>
Cc:	linux-kernel@...r.kernel.org, tglx@...utronix.de
Subject: Re: [PATCH] timer: optimize apply_slack()

On Sat, 2012-03-17 at 22:31 +0100, Felix Fietkau wrote:
> __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@...nwrt.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;
>  

Not a comment on your patch, but this code seems not correct.

This probably should be :

	mask = (1UL << bit) - 1;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ