diff mbox series

riscv: enable GENERIC_FIND_FIRST_BIT

Message ID 20210718001423.6b8e1d23@xhacker (mailing list archive)
State New, archived
Headers show
Series riscv: enable GENERIC_FIND_FIRST_BIT | expand

Commit Message

Jisheng Zhang July 17, 2021, 4:14 p.m. UTC
From: Jisheng Zhang <jszhang@kernel.org>

riscv doesn't implement architecture-optimized bitsearching functions
such as find_first_{zero}_bit() etc.

When GENERIC_FIND_FIRST_BIT=n, find_first_bit() is implemented with
find_next_bit() which is less efficient. Enable GENERIC_FIND_FIRST_BIT
for riscv to get more optimized find_first_bit() implementation, an
initial test(lib/find_bit_benchmark) shows find_first_bit() performance
is improved by nearly 32%.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
 arch/riscv/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Jisheng Zhang Sept. 8, 2021, 3:04 p.m. UTC | #1
Hi Palmer,

On Sun, 18 Jul 2021 00:14:23 +0800
Jisheng Zhang wrote:

> From: Jisheng Zhang <jszhang@kernel.org>
> 
> riscv doesn't implement architecture-optimized bitsearching functions
> such as find_first_{zero}_bit() etc.
> 
> When GENERIC_FIND_FIRST_BIT=n, find_first_bit() is implemented with
> find_next_bit() which is less efficient. Enable GENERIC_FIND_FIRST_BIT
> for riscv to get more optimized find_first_bit() implementation, an
> initial test(lib/find_bit_benchmark) shows find_first_bit() performance
> is improved by nearly 32%.

It seems this patch is missed. Is it possible to pick it up for 2nd 5.15-rc1 PR?

Thanks

> 
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
>  arch/riscv/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 8fcceb8eda07..7ebc54c5c245 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -47,6 +47,7 @@ config RISCV
>  	select GENERIC_ATOMIC64 if !64BIT
>  	select GENERIC_CLOCKEVENTS_BROADCAST if SMP
>  	select GENERIC_EARLY_IOREMAP
> +	select GENERIC_FIND_FIRST_BIT
>  	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
>  	select GENERIC_IOREMAP
>  	select GENERIC_IRQ_MULTI_HANDLER
Kefeng Wang Sept. 9, 2021, 12:58 a.m. UTC | #2
On 2021/9/8 23:04, Jisheng Zhang wrote:
> Hi Palmer,
>
> On Sun, 18 Jul 2021 00:14:23 +0800
> Jisheng Zhang wrote:
>
>> From: Jisheng Zhang <jszhang@kernel.org>
>>
>> riscv doesn't implement architecture-optimized bitsearching functions
>> such as find_first_{zero}_bit() etc.
>>
>> When GENERIC_FIND_FIRST_BIT=n, find_first_bit() is implemented with
>> find_next_bit() which is less efficient. Enable GENERIC_FIND_FIRST_BIT
>> for riscv to get more optimized find_first_bit() implementation, an
>> initial test(lib/find_bit_benchmark) shows find_first_bit() performance
>> is improved by nearly 32%.
> It seems this patch is missed. Is it possible to pick it up for 2nd 5.15-rc1 PR?
>
> Thanks

It is enabled unconditionally by following commit

commit dbbccfe505ef8fae804677abf0564c1e07479102

Author: Yury Norov <yury.norov@gmail.com>
Date:   Tue Aug 24 09:59:56 2021 +1000

     arch: remove GENERIC_FIND_FIRST_BIT entirely

>
>> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
>> ---
>>   arch/riscv/Kconfig | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
>> index 8fcceb8eda07..7ebc54c5c245 100644
>> --- a/arch/riscv/Kconfig
>> +++ b/arch/riscv/Kconfig
>> @@ -47,6 +47,7 @@ config RISCV
>>   	select GENERIC_ATOMIC64 if !64BIT
>>   	select GENERIC_CLOCKEVENTS_BROADCAST if SMP
>>   	select GENERIC_EARLY_IOREMAP
>> +	select GENERIC_FIND_FIRST_BIT
>>   	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
>>   	select GENERIC_IOREMAP
>>   	select GENERIC_IRQ_MULTI_HANDLER
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
> .
>
Jisheng Zhang Sept. 9, 2021, 1:49 p.m. UTC | #3
On Thu, 9 Sep 2021 08:58:31 +0800
Kefeng Wang <wangkefeng.wang@huawei.com> wrote:

> On 2021/9/8 23:04, Jisheng Zhang wrote:
> > Hi Palmer,
> >
> > On Sun, 18 Jul 2021 00:14:23 +0800
> > Jisheng Zhang wrote:
> >  
> >> From: Jisheng Zhang <jszhang@kernel.org>
> >>
> >> riscv doesn't implement architecture-optimized bitsearching functions
> >> such as find_first_{zero}_bit() etc.
> >>
> >> When GENERIC_FIND_FIRST_BIT=n, find_first_bit() is implemented with
> >> find_next_bit() which is less efficient. Enable GENERIC_FIND_FIRST_BIT
> >> for riscv to get more optimized find_first_bit() implementation, an
> >> initial test(lib/find_bit_benchmark) shows find_first_bit() performance
> >> is improved by nearly 32%.  
> > It seems this patch is missed. Is it possible to pick it up for 2nd 5.15-rc1 PR?
> >
> > Thanks  
> 
> It is enabled unconditionally by following commit
> 
> commit dbbccfe505ef8fae804677abf0564c1e07479102
> 
> Author: Yury Norov <yury.norov@gmail.com>
> Date:   Tue Aug 24 09:59:56 2021 +1000
> 
>      arch: remove GENERIC_FIND_FIRST_BIT entirely
> 

Aha, thanks for the information. After Yury's commit, this patch
is useless now.

thanks
diff mbox series

Patch

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 8fcceb8eda07..7ebc54c5c245 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -47,6 +47,7 @@  config RISCV
 	select GENERIC_ATOMIC64 if !64BIT
 	select GENERIC_CLOCKEVENTS_BROADCAST if SMP
 	select GENERIC_EARLY_IOREMAP
+	select GENERIC_FIND_FIRST_BIT
 	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
 	select GENERIC_IOREMAP
 	select GENERIC_IRQ_MULTI_HANDLER