public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] bitops: optimize fns() for more
@ 2024-05-02 23:32 Yury Norov
  2024-05-02 23:32 ` [PATCH 1/4] lib: make test_bitops compilable into the kernel image Yury Norov
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Yury Norov @ 2024-05-02 23:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Yury Norov, Rasmus Villemoes, Andrew Morton, Kuan-Wei Chiu

This series follows up [1].

[1] improves performance by switching from __ffs() + __clear_bit()
in fns() to the equivalent but much faster expression that searches
and clears first N-1 bits:

	while (word && n--)
		word &= word - 1;

We can squeeze out of fns() even more by replacing linear walk over all
the bits in a word with a binary search.

Patch #3 implements it by adding fns8(), fns16(), fns32() and fns64(), 
and patches 1 and 2 are cleanups related to fns().

The last patch creates a MAINTAINERS record for bitops. Currently they
aren't maintained. I add Rasmus and myself as a reviewer and maintainer,
accordingly, just like for bitmaps. Rasmus, please let me know if you
don't want to review it.

[1] https://lore.kernel.org/linux-kernel/20240502092443.6845-2-visitorckw@gmail.com/T/

Yury Norov (4):
  lib: make test_bitops compilable into the kernel image
  bitmap: relax find_nth_bit() limitation on return value
  bitops: squeeze even more out of fns()
  MAINTAINERS: add BITOPS API record

 MAINTAINERS            | 13 +++++++++++++
 include/linux/bitops.h | 42 +++++++++++++++++++++++++++++++++++++-----
 include/linux/find.h   |  2 +-
 lib/Kconfig.debug      |  1 -
 lib/find_bit.c         |  2 +-
 lib/test_bitmap.c      |  4 ++--
 6 files changed, 54 insertions(+), 10 deletions(-)

-- 
2.40.1


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

end of thread, other threads:[~2024-05-04  8:53 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-02 23:32 [PATCH 0/4] bitops: optimize fns() for more Yury Norov
2024-05-02 23:32 ` [PATCH 1/4] lib: make test_bitops compilable into the kernel image Yury Norov
2024-05-03  2:00   ` Kuan-Wei Chiu
2024-05-03  2:14     ` Yury Norov
2024-05-03  2:24       ` Kuan-Wei Chiu
2024-05-03 15:13         ` Yury Norov
2024-05-03 15:29           ` Kuan-Wei Chiu
2024-05-02 23:32 ` [PATCH 2/4] bitmap: relax find_nth_bit() limitation on return value Yury Norov
2024-05-02 23:32 ` [PATCH 3/4] bitops: squeeze even more out of fns() Yury Norov
2024-05-03  2:19   ` Kuan-Wei Chiu
2024-05-03 16:13     ` Yury Norov
2024-05-04  8:53       ` Kuan-Wei Chiu
2024-05-02 23:32 ` [PATCH 4/4] MAINTAINERS: add BITOPS API record Yury Norov

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