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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZN3qQPeFtdZQrLE4@smile.fi.intel.com>
Date:   Thu, 17 Aug 2023 12:37:04 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Yury Norov <yury.norov@...il.com>
Cc:     linux-kernel@...r.kernel.org,
        Rasmus Villemoes <linux@...musvillemoes.dk>
Subject: Re: [PATCH] bitmap: optimize bitmap_remap()

On Tue, Aug 15, 2023 at 04:59:34PM -0700, Yury Norov wrote:
> When 'new' map is empty, i.e. identity mapping, we can simply copy
> src to dst, which is significantly faster than setting bits one by
> one in a for-loop.

> While here, replace set_bit() with non-atomic __set_bit().

I believe this requires a separate change with additional words
why it's okay to drop atomicity.

...

>  	for_each_set_bit(oldbit, src, nbits) {
>  		int n = bitmap_pos_to_ord(old, oldbit, nbits);
>  
> +		bit = (n < 0) ? oldbit :	/* identity map */

Can't you also optimize this case?

Something like

  bitmap_xor(tmp, old, new) // maybe even better approach, dunno
  bitmap_empty(tmp) // can be replaced by find first bit

?

> +				find_nth_bit(new, nbits, n % w);
> +		__set_bit(bit, dst);
>  	}

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ