[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210406181541.GA792963@yury-ThinkPad>
Date: Tue, 6 Apr 2021 11:15:41 -0700
From: Yury Norov <yury.norov@...il.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: linux-kernel@...r.kernel.org, linux-m68k@...ts.linux-m68k.org,
linux-arch@...r.kernel.org, linux-sh@...r.kernel.org,
Alexey Klimov <aklimov@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Arnd Bergmann <arnd@...db.de>, David Sterba <dsterba@...e.com>,
Dennis Zhou <dennis@...nel.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Jianpeng Ma <jianpeng.ma@...el.com>,
Joe Perches <joe@...ches.com>,
John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Rich Felker <dalias@...c.org>,
Stefano Brivio <sbrivio@...hat.com>,
Wei Yang <richard.weiyang@...ux.alibaba.com>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Yoshinori Sato <ysato@...rs.sourceforge.jp>
Subject: Re: [PATCH 11/13] lib: add fast path for find_first_*_bit() and
find_last_bit()
On Tue, Apr 06, 2021 at 09:03:27AM -0700, Guenter Roeck wrote:
> On Mon, Mar 15, 2021 at 06:54:22PM -0700, Yury Norov wrote:
> > Similarly to bitmap functions, users would benefit if we'll handle
> > a case of small-size bitmaps that fit into a single word.
> >
> > While here, move the find_last_bit() declaration to bitops/find.h
> > where other find_*_bit() functions sit.
> >
> > Signed-off-by: Yury Norov <yury.norov@...il.com>
> > ---
> > include/asm-generic/bitops/find.h | 50 ++++++++++++++++++++++++++++---
> > include/linux/bitops.h | 12 --------
> > lib/find_bit.c | 12 ++++----
> > 3 files changed, 52 insertions(+), 22 deletions(-)
> >
> > diff --git a/include/asm-generic/bitops/find.h b/include/asm-generic/bitops/find.h
> > index 4148c74a1e4d..8d818b304869 100644
> > --- a/include/asm-generic/bitops/find.h
> > +++ b/include/asm-generic/bitops/find.h
> > @@ -5,6 +5,9 @@
> > extern unsigned long _find_next_bit(const unsigned long *addr1,
> > const unsigned long *addr2, unsigned long nbits,
> > unsigned long start, unsigned long invert, unsigned long le);
> > +extern unsigned long _find_first_bit(const unsigned long *addr, unsigned long size);
> > +extern unsigned long _find_first_zero_bit(const unsigned long *addr, unsigned long size);
> > +extern unsigned long _find_last_bit(const unsigned long *addr, unsigned long size);
> >
> > #ifndef find_next_bit
> > /**
> > @@ -102,8 +105,17 @@ unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
> > * Returns the bit number of the first set bit.
> > * If no bits are set, returns @size.
> > */
> > -extern unsigned long find_first_bit(const unsigned long *addr,
> > - unsigned long size);
> > +static inline
> > +unsigned long find_first_bit(const unsigned long *addr, unsigned long size)
> > +{
> > + if (small_const_nbits(size)) {
> > + unsigned long val = *addr & BITS_FIRST(size - 1);
> > +
> > + return val ? __ffs(val) : size;
>
> This patch results in:
>
> include/asm-generic/bitops/find.h: In function 'find_last_bit':
> include/asm-generic/bitops/find.h:164:16: error: implicit declaration of function '__fls'; did you mean '__ffs'?
>
> and:
>
> ./include/asm-generic/bitops/__fls.h: At top level:
> ./include/asm-generic/bitops/__fls.h:13:38: error: conflicting types for '__fls'
>
> when building scripts/mod/devicetable-offsets.o.
>
> Seen with h8300 builds.
>
> Guenter
The patch is here:
https://lkml.org/lkml/2021/4/1/1184
Yury
Powered by blists - more mailing lists