diff mbox series

[2/2] MIPS: enable GENERIC_FIND_FIRST_BIT

Message ID 20210225135700.1381396-3-yury.norov@gmail.com (mailing list archive)
State New, archived
Headers show
Series arch: enable GENERIC_FIND_FIRST_BIT for MIPS and ARM64 | expand

Commit Message

Yury Norov Feb. 25, 2021, 1:57 p.m. UTC
From: Alexander Lobakin <alobakin@pm.me>

MIPS doesn't have architecture-optimized bitsearching functions,
like find_{first,next}_bit() etc.
It's absolutely harmless to enable GENERIC_FIND_FIRST_BIT as this
functionality is not new at all and well-tested. It provides more
optimized code and saves some .text memory (32 R2):

add/remove: 4/1 grow/shrink: 1/53 up/down: 216/-372 (-156)

Users of for_each_set_bit() like hotpath gic_handle_shared_int()
will also benefit from this.

Suggested-by: Yury Norov <yury.norov@gmail.com>
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 arch/mips/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Huacai Chen Feb. 26, 2021, 1:22 a.m. UTC | #1
Hi, Yury,

On Thu, Feb 25, 2021 at 9:59 PM Yury Norov <yury.norov@gmail.com> wrote:
>
> From: Alexander Lobakin <alobakin@pm.me>
>
> MIPS doesn't have architecture-optimized bitsearching functions,
> like find_{first,next}_bit() etc.
Emm, I think MIPS can use clo/clz to optimize bitsearching functions.

Huacai

> It's absolutely harmless to enable GENERIC_FIND_FIRST_BIT as this
> functionality is not new at all and well-tested. It provides more
> optimized code and saves some .text memory (32 R2):
>
> add/remove: 4/1 grow/shrink: 1/53 up/down: 216/-372 (-156)
>
> Users of for_each_set_bit() like hotpath gic_handle_shared_int()
> will also benefit from this.
>
> Suggested-by: Yury Norov <yury.norov@gmail.com>
> Signed-off-by: Alexander Lobakin <alobakin@pm.me>
> Signed-off-by: Yury Norov <yury.norov@gmail.com>
> ---
>  arch/mips/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index d89efba3d8a4..164bdd715d4b 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -26,6 +26,7 @@ config MIPS
>         select GENERIC_ATOMIC64 if !64BIT
>         select GENERIC_CMOS_UPDATE
>         select GENERIC_CPU_AUTOPROBE
> +       select GENERIC_FIND_FIRST_BIT
>         select GENERIC_GETTIMEOFDAY
>         select GENERIC_IOMAP
>         select GENERIC_IRQ_PROBE
> --
> 2.25.1
>
Yury Norov Feb. 26, 2021, 4:07 a.m. UTC | #2
On Fri, Feb 26, 2021 at 09:22:18AM +0800, Huacai Chen wrote:
> Hi, Yury,
> 
> On Thu, Feb 25, 2021 at 9:59 PM Yury Norov <yury.norov@gmail.com> wrote:
> >
> > From: Alexander Lobakin <alobakin@pm.me>
> >
> > MIPS doesn't have architecture-optimized bitsearching functions,
> > like find_{first,next}_bit() etc.
> Emm, I think MIPS can use clo/clz to optimize bitsearching functions.

find_{first,next}_bit() is about manipulating the bitmaps bigger that
a single word, and some arches (arm) implement their own find_bit()
functions. find_bit() is not a replacement of __ffs() and ffz().

> Huacai
> 
> > It's absolutely harmless to enable GENERIC_FIND_FIRST_BIT as this
> > functionality is not new at all and well-tested. It provides more
> > optimized code and saves some .text memory (32 R2):
> >
> > add/remove: 4/1 grow/shrink: 1/53 up/down: 216/-372 (-156)
> >
> > Users of for_each_set_bit() like hotpath gic_handle_shared_int()
> > will also benefit from this.
> >
> > Suggested-by: Yury Norov <yury.norov@gmail.com>
> > Signed-off-by: Alexander Lobakin <alobakin@pm.me>
> > Signed-off-by: Yury Norov <yury.norov@gmail.com>
> > ---
> >  arch/mips/Kconfig | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> > index d89efba3d8a4..164bdd715d4b 100644
> > --- a/arch/mips/Kconfig
> > +++ b/arch/mips/Kconfig
> > @@ -26,6 +26,7 @@ config MIPS
> >         select GENERIC_ATOMIC64 if !64BIT
> >         select GENERIC_CMOS_UPDATE
> >         select GENERIC_CPU_AUTOPROBE
> > +       select GENERIC_FIND_FIRST_BIT
> >         select GENERIC_GETTIMEOFDAY
> >         select GENERIC_IOMAP
> >         select GENERIC_IRQ_PROBE
> > --
> > 2.25.1
> >
Thomas Bogendoerfer March 1, 2021, 2:49 p.m. UTC | #3
On Thu, Feb 25, 2021 at 05:57:00AM -0800, Yury Norov wrote:
> From: Alexander Lobakin <alobakin@pm.me>
> 
> MIPS doesn't have architecture-optimized bitsearching functions,
> like find_{first,next}_bit() etc.
> It's absolutely harmless to enable GENERIC_FIND_FIRST_BIT as this
> functionality is not new at all and well-tested. It provides more
> optimized code and saves some .text memory (32 R2):
> 
> add/remove: 4/1 grow/shrink: 1/53 up/down: 216/-372 (-156)
> 
> Users of for_each_set_bit() like hotpath gic_handle_shared_int()
> will also benefit from this.
> 
> Suggested-by: Yury Norov <yury.norov@gmail.com>
> Signed-off-by: Alexander Lobakin <alobakin@pm.me>
> Signed-off-by: Yury Norov <yury.norov@gmail.com>
> ---
>  arch/mips/Kconfig | 1 +
>  1 file changed, 1 insertion(+)

applied to mips-next.

Thomas.
diff mbox series

Patch

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index d89efba3d8a4..164bdd715d4b 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -26,6 +26,7 @@  config MIPS
 	select GENERIC_ATOMIC64 if !64BIT
 	select GENERIC_CMOS_UPDATE
 	select GENERIC_CPU_AUTOPROBE
+	select GENERIC_FIND_FIRST_BIT
 	select GENERIC_GETTIMEOFDAY
 	select GENERIC_IOMAP
 	select GENERIC_IRQ_PROBE