lkml.org 
[lkml]   [2022]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH 0/5] lib/find: add find_nth_bit()
Date
Kernel lacks for a function that searches for Nth bit in a bitmap.
Usually people do it like this:
for_each_set_bit(bit, mask, size)
if (--n == 0)
return bit;

Which is not so elegant, and very slow.

This series adds fast routines for this task, and applies them where
appropriate.

While here, move thin wrappers around find_bit() in nodemask.c to a
corresponding header, and because nodemask.c is empty after that,
remove it.

On top of "lib: cleanup bitmap-related headers":
https://lkml.org/lkml/2022/7/6/1202

Yury Norov (5):
lib: add find_nth(,and,andnot)_bit()
lib/bitmap: add tests for find_nth_bit()
remove bitmap_ord_to_pos
cpumask: add cpumask_nth_{,and,andnot}
lib/nodemask: inline next_node_in() and node_random()

MAINTAINERS | 1 -
include/linux/bitmap.h | 1 -
include/linux/bitops.h | 19 ++++++++++
include/linux/cpumask.h | 44 ++++++++++++++++++++++
include/linux/find.h | 79 ++++++++++++++++++++++++++++++++++++++++
include/linux/nodemask.h | 27 +++++++++++---
lib/Makefile | 2 +-
lib/bitmap.c | 36 ++----------------
lib/cpumask.c | 26 ++++++-------
lib/find_bit.c | 20 ++++++++++
lib/find_bit_benchmark.c | 17 +++++++++
lib/nodemask.c | 31 ----------------
lib/test_bitmap.c | 36 +++++++++++++++++-
13 files changed, 250 insertions(+), 89 deletions(-)
delete mode 100644 lib/nodemask.c

--
2.34.1

\
 
 \ /
  Last update: 2022-07-06 20:25    [W:0.411 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site