lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALSpo=b4dO3B=U5+cfc3P0NnrtMf7_FJv6+vOPHCS_ezZR2XJw@mail.gmail.com>
Date: Mon, 11 Aug 2025 08:18:07 -0700
From: Jesse Taube <jesse@...osinc.com>
To: Fushuai Wang <wangfushuai@...du.com>
Cc: linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org, 
	paul.walmsley@...ive.com, palmer@...belt.com, aou@...s.berkeley.edu, 
	alex@...ti.fr, ajones@...tanamicro.com, cleger@...osinc.com, 
	charlie@...osinc.com, evan@...osinc.com
Subject: Re: [PATCH] riscv: Use for_each_online_cpu() instead of for_each_cpu()

On Sun, Aug 10, 2025 at 11:34 PM Fushuai Wang <wangfushuai@...du.com> wrote:
>
> Replace the opencoded for_each_cpu(cpu, cpu_online_mask) loop with the
> more readable and equivalent for_each_online_cpu(cpu) macro.
>
> Signed-off-by: Fushuai Wang <wangfushuai@...du.com>
> ---
>  arch/riscv/kernel/unaligned_access_speed.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/riscv/kernel/unaligned_access_speed.c b/arch/riscv/kernel/unaligned_access_speed.c
> index ae2068425fbc..5e11b1bd9b2a 100644
> --- a/arch/riscv/kernel/unaligned_access_speed.c
> +++ b/arch/riscv/kernel/unaligned_access_speed.c
> @@ -150,7 +150,7 @@ static void __init check_unaligned_access_speed_all_cpus(void)
>          * Allocate separate buffers for each CPU so there's no fighting over
>          * cache lines.
>          */
> -       for_each_cpu(cpu, cpu_online_mask) {
> +       for_each_online_cpu(cpu) {
>                 bufs[cpu] = alloc_pages(GFP_KERNEL, MISALIGNED_BUFFER_ORDER);
>                 if (!bufs[cpu]) {
>                         pr_warn("Allocation failure, not measuring misaligned performance\n");
> @@ -165,7 +165,7 @@ static void __init check_unaligned_access_speed_all_cpus(void)
>         smp_call_on_cpu(0, check_unaligned_access, bufs[0], true);
>
>  out:
> -       for_each_cpu(cpu, cpu_online_mask) {
> +       for_each_online_cpu(cpu) {

Good find.
Reviewed-by: Jesse Taube <jesse@...osinc.com>

>                 if (bufs[cpu])
>                         __free_pages(bufs[cpu], MISALIGNED_BUFFER_ORDER);
>         }
> --
> 2.36.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ