mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: linux-kernel@vger.kernel.org,
	"Alexander Lobakin" <alexandr.lobakin@intel.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"David Gow" <davidgow@google.com>,
	"Eric Dumazet" <edumazet@google.com>,
	"Isabella Basso" <isabbasso@riseup.net>,
	"Kees Cook" <keescook@chromium.org>,
	"Keith Busch" <kbusch@kernel.org>,
	"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
	"Marco Elver" <elver@google.com>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: Yury Norov <yury.norov@gmail.com>
Subject: [PATCH 0/5] lib/find: add find_nth_bit()
Date: Wed,  6 Jul 2022 11:22:55 -0700	[thread overview]
Message-ID: <20220706182300.70862-1-yury.norov@gmail.com> (raw)

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


             reply	other threads:[~2022-07-06 18:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-06 18:22 Yury Norov [this message]
2022-07-06 18:22 ` [PATCH 1/5] lib: add find_nth(,and,andnot)_bit() Yury Norov
2022-07-07  7:25   ` Rasmus Villemoes
2022-07-07 21:03     ` Yury Norov
2022-07-08  8:26       ` Rasmus Villemoes
2022-07-08  9:12         ` Andy Shevchenko
2022-07-08 16:40           ` Yury Norov
2022-07-06 18:22 ` [PATCH 2/5] lib/bitmap: add tests for find_nth_bit() Yury Norov
2022-07-06 18:22 ` [PATCH 3/5] lib/bitmap: remove bitmap_ord_to_pos Yury Norov
2022-07-06 18:22 ` [PATCH 4/5] cpumask: add cpumask_nth_{,and,andnot} Yury Norov
2022-07-06 18:23 ` [PATCH 5/5] lib/nodemask: inline next_node_in() and node_random() Yury Norov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220706182300.70862-1-yury.norov@gmail.com \
    --to=yury.norov@gmail.com \
    --cc=alexandr.lobakin@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=davidgow@google.com \
    --cc=edumazet@google.com \
    --cc=elver@google.com \
    --cc=isabbasso@riseup.net \
    --cc=kbusch@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mark.rutland@arm.com \
    --cc=memxor@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=toke@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®