[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vf8EhRYWdQN6Oc79GzWCvo-sRJDvy7_Aek_Z63GCu2dMQ@mail.gmail.com>
Date: Mon, 11 Jul 2022 10:55:08 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Yury Norov <yury.norov@...il.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Alexander Lobakin <alexandr.lobakin@...el.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Arnd Bergmann <arnd@...db.de>, David Gow <davidgow@...gle.com>,
Eric Dumazet <edumazet@...gle.com>,
Isabella Basso <isabbasso@...eup.net>,
Kees Cook <keescook@...omium.org>,
Keith Busch <kbusch@...nel.org>,
Kumar Kartikeya Dwivedi <memxor@...il.com>,
Marco Elver <elver@...gle.com>,
Mark Rutland <mark.rutland@....com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Steven Rostedt <rostedt@...dmis.org>,
Toke Høiland-Jørgensen <toke@...hat.com>
Subject: Re: [PATCH v2 0/5] lib/find: add find_nth_bit()
On Mon, Jul 11, 2022 at 6:51 AM Yury Norov <yury.norov@...il.com> wrote:
>
> 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.
>
> v1: https://lore.kernel.org/lkml/20220706182300.70862-4-yury.norov@gmail.com/T/
> v2: - count Nth bit from 0 (was 1);
> - use 'invert' trick in _find_nth_bit(), as in _find_next_bit();
> - cleanup comments;
> - fns() is kept inline - looking at __ffs() generic implementation,
> I decided to keep it untouched.
Two observations:
1) your patches are not versioned (hint: use `git format-patch
--thread -vX --cover-letter ...`, where X is a version you want to
give);
2) fns() is not good abbreviation, because among ffs (First) and fls
(Last), fns would be read as Next, which is misleading, I'm not sure
fnths(), which is correct, is good for readers.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists