linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc/fsl/qbman: Use for_each_online_cpu() instead of for_each_cpu()
@ 2025-08-11  6:52 Fushuai Wang
  2025-08-11 16:46 ` Shrikanth Hegde
  0 siblings, 1 reply; 3+ messages in thread
From: Fushuai Wang @ 2025-08-11  6:52 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linuxppc-dev
  Cc: frederic, christophe.leroy, Fushuai Wang

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@baidu.com>
---
 drivers/soc/fsl/qbman/qman_test_stash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/fsl/qbman/qman_test_stash.c b/drivers/soc/fsl/qbman/qman_test_stash.c
index f4d3c2146f4f..6f7597950aa3 100644
--- a/drivers/soc/fsl/qbman/qman_test_stash.c
+++ b/drivers/soc/fsl/qbman/qman_test_stash.c
@@ -103,7 +103,7 @@ static int on_all_cpus(int (*fn)(void))
 {
 	int cpu;
 
-	for_each_cpu(cpu, cpu_online_mask) {
+	for_each_online_cpu(cpu) {
 		struct bstrap bstrap = {
 			.fn = fn,
 			.started = ATOMIC_INIT(0)
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] soc/fsl/qbman: Use for_each_online_cpu() instead of for_each_cpu()
  2025-08-11  6:52 [PATCH] soc/fsl/qbman: Use for_each_online_cpu() instead of for_each_cpu() Fushuai Wang
@ 2025-08-11 16:46 ` Shrikanth Hegde
  2025-08-12  4:56   ` Fushuai Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Shrikanth Hegde @ 2025-08-11 16:46 UTC (permalink / raw)
  To: Fushuai Wang
  Cc: frederic, christophe.leroy, linux-kernel, linux-arm-kernel,
	linuxppc-dev



On 8/11/25 12:22, Fushuai Wang 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@baidu.com>
> ---
>   drivers/soc/fsl/qbman/qman_test_stash.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/fsl/qbman/qman_test_stash.c b/drivers/soc/fsl/qbman/qman_test_stash.c
> index f4d3c2146f4f..6f7597950aa3 100644
> --- a/drivers/soc/fsl/qbman/qman_test_stash.c
> +++ b/drivers/soc/fsl/qbman/qman_test_stash.c
> @@ -103,7 +103,7 @@ static int on_all_cpus(int (*fn)(void))
>   {
>   	int cpu;
>   
> -	for_each_cpu(cpu, cpu_online_mask) {
> +	for_each_online_cpu(cpu) {
>   		struct bstrap bstrap = {
>   			.fn = fn,
>   			.started = ATOMIC_INIT(0)

Yes. This change makes sense given that for_each_online_cpu expands into the same.

Why not do for the remaining ones too?

linux_tip$ grep -Rw "for_each_cpu" * | grep  cpu_online_mask
arch/riscv/kernel/unaligned_access_speed.c:     for_each_cpu(cpu, cpu_online_mask) {
arch/riscv/kernel/unaligned_access_speed.c:     for_each_cpu(cpu, cpu_online_mask) {
drivers/soc/fsl/qbman/qman_test_stash.c:        for_each_cpu(cpu, cpu_online_mask) {    ** current patch addresses this.
drivers/infiniband/hw/hfi1/sdma.c:      for_each_cpu(cpu, cpu_online_mask) {
drivers/cpuidle/cpuidle-tegra.c:        for_each_cpu(lcpu, cpu_online_mask) {
include/rv/da_monitor.h:        for_each_cpu(cpu, cpu_online_mask) {
kernel/trace/trace_osnoise.c:   for_each_cpu(cpu, cpu_online_mask) {
kernel/trace/trace_osnoise.c:   for_each_cpu(cpu, cpu_online_mask) {


Rest everyone seems to have moved.
linux_tip$ grep -Rw "for_each_online_cpu" * | wc
     416    1141   23047



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] soc/fsl/qbman: Use for_each_online_cpu() instead of for_each_cpu()
  2025-08-11 16:46 ` Shrikanth Hegde
@ 2025-08-12  4:56   ` Fushuai Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Fushuai Wang @ 2025-08-12  4:56 UTC (permalink / raw)
  To: sshegde
  Cc: christophe.leroy, frederic, linux-arm-kernel, linux-kernel,
	linuxppc-dev, wangfushuai

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="y", Size: 1944 bytes --]

>> 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@baidu.com>
>> ---
>>   drivers/soc/fsl/qbman/qman_test_stash.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/soc/fsl/qbman/qman_test_stash.c b/drivers/soc/fsl/qbman/qman_test_stash.c
>> index f4d3c2146f4f..6f7597950aa3 100644
>> --- a/drivers/soc/fsl/qbman/qman_test_stash.c
>> +++ b/drivers/soc/fsl/qbman/qman_test_stash.c
>> @@ -103,7 +103,7 @@ static int on_all_cpus(int (*fn)(void))
>>   {
>>   	int cpu;
>>   
>> -	for_each_cpu(cpu, cpu_online_mask) {
>> +	for_each_online_cpu(cpu) {
>>   		struct bstrap bstrap = {
>>   			.fn = fn,
>>   			.started = ATOMIC_INIT(0)
> 
> Yes. This change makes sense given that for_each_online_cpu expands into the same.
> 
> Why not do for the remaining ones too?

I’m working on updating the remaining instances as well.
To keep the commits clear, I’m sending separate patches for each file/subsystem.

Regards,
Wang.

> linux_tip$ grep -Rw "for_each_cpu" * | grep  cpu_online_mask
> arch/riscv/kernel/unaligned_access_speed.c:     for_each_cpu(cpu, cpu_online_mask) {
> arch/riscv/kernel/unaligned_access_speed.c:     for_each_cpu(cpu, cpu_online_mask) {
> drivers/soc/fsl/qbman/qman_test_stash.c:        for_each_cpu(cpu, cpu_online_mask) {    ** current patch addresses this.
> drivers/infiniband/hw/hfi1/sdma.c:      for_each_cpu(cpu, cpu_online_mask) {
> drivers/cpuidle/cpuidle-tegra.c:        for_each_cpu(lcpu, cpu_online_mask) {
> include/rv/da_monitor.h:        for_each_cpu(cpu, cpu_online_mask) {
> kernel/trace/trace_osnoise.c:   for_each_cpu(cpu, cpu_online_mask) {
> kernel/trace/trace_osnoise.c:   for_each_cpu(cpu, cpu_online_mask) {
> 
> 
> Rest everyone seems to have moved.
> linux_tip$ grep -Rw "for_each_online_cpu" * | wc
>      416    1141   23047

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-12  4:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11  6:52 [PATCH] soc/fsl/qbman: Use for_each_online_cpu() instead of for_each_cpu() Fushuai Wang
2025-08-11 16:46 ` Shrikanth Hegde
2025-08-12  4:56   ` Fushuai Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).