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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 9 Nov 2023 18:21:13 -0800
From:   Yury Norov <yury.norov@...il.com>
To:     linux-kernel@...r.kernel.org
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>
Subject: Re: [PATCH] lib/find: optimize find_*_bit_wrap

Ping?

On Sat, Oct 28, 2023 at 12:05:29PM -0700, Yury Norov wrote:
> When an offset is 0, there's no need to search a bitmap from the
> beginning after the 1st search failed, because each bit has already
> been tested.
> 
> Signed-off-by: Yury Norov <yury.norov@...il.com>
> ---
>  include/linux/find.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/find.h b/include/linux/find.h
> index 5e4f39ef2e72..241b6d028eda 100644
> --- a/include/linux/find.h
> +++ b/include/linux/find.h
> @@ -405,7 +405,7 @@ unsigned long find_next_and_bit_wrap(const unsigned long *addr1,
>  {
>  	unsigned long bit = find_next_and_bit(addr1, addr2, size, offset);
>  
> -	if (bit < size)
> +	if (bit < size || offset == 0)
>  		return bit;
>  
>  	bit = find_first_and_bit(addr1, addr2, offset);
> @@ -427,7 +427,7 @@ unsigned long find_next_bit_wrap(const unsigned long *addr,
>  {
>  	unsigned long bit = find_next_bit(addr, size, offset);
>  
> -	if (bit < size)
> +	if (bit < size || offset == 0)
>  		return bit;
>  
>  	bit = find_first_bit(addr, offset);
> -- 
> 2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ