* [PATCH] sched: remove unnecessary check in sched_{debug_}start()
@ 2025-08-07 3:40 Fushuai Wang
2025-08-19 11:23 ` Valentin Schneider
2025-10-06 0:41 ` Fushuai Wang
0 siblings, 2 replies; 3+ messages in thread
From: Fushuai Wang @ 2025-08-07 3:40 UTC (permalink / raw)
To: linux-kernel
Cc: vschneid, mgorman, bsegall, rostedt, dietmar.eggemann,
vincent.guittot, juri.lelli, peterz, mingo, Fushuai Wang
-1 is a legal argument for cpumask_next(), and cpumask_next(-1, mask) is
equivalent to cpumask_first(mask). The explicit check and separate branch
are unnecessary.
Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
---
kernel/sched/debug.c | 5 +----
kernel/sched/stats.c | 5 +----
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 3f06ab84d53f..1b3592bac62b 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -1080,10 +1080,7 @@ static void *sched_debug_start(struct seq_file *file, loff_t *offset)
n--;
- if (n > 0)
- n = cpumask_next(n - 1, cpu_online_mask);
- else
- n = cpumask_first(cpu_online_mask);
+ n = cpumask_next(n - 1, cpu_online_mask);
*offset = n + 1;
diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c
index d1c9429a4ac5..f93b1c87c538 100644
--- a/kernel/sched/stats.c
+++ b/kernel/sched/stats.c
@@ -181,10 +181,7 @@ static void *schedstat_start(struct seq_file *file, loff_t *offset)
n--;
- if (n > 0)
- n = cpumask_next(n - 1, cpu_online_mask);
- else
- n = cpumask_first(cpu_online_mask);
+ n = cpumask_next(n - 1, cpu_online_mask);
*offset = n + 1;
--
2.36.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sched: remove unnecessary check in sched_{debug_}start()
2025-08-07 3:40 [PATCH] sched: remove unnecessary check in sched_{debug_}start() Fushuai Wang
@ 2025-08-19 11:23 ` Valentin Schneider
2025-10-06 0:41 ` Fushuai Wang
1 sibling, 0 replies; 3+ messages in thread
From: Valentin Schneider @ 2025-08-19 11:23 UTC (permalink / raw)
To: Fushuai Wang, linux-kernel
Cc: mgorman, bsegall, rostedt, dietmar.eggemann, vincent.guittot,
juri.lelli, peterz, mingo, Fushuai Wang
On 07/08/25 11:40, Fushuai Wang wrote:
> -1 is a legal argument for cpumask_next(), and cpumask_next(-1, mask) is
> equivalent to cpumask_first(mask). The explicit check and separate branch
> are unnecessary.
>
> Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
Reviewed-by: Valentin Schneider <vschneid@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sched: remove unnecessary check in sched_{debug_}start()
2025-08-07 3:40 [PATCH] sched: remove unnecessary check in sched_{debug_}start() Fushuai Wang
2025-08-19 11:23 ` Valentin Schneider
@ 2025-10-06 0:41 ` Fushuai Wang
1 sibling, 0 replies; 3+ messages in thread
From: Fushuai Wang @ 2025-10-06 0:41 UTC (permalink / raw)
To: wangfushuai
Cc: bsegall, dietmar.eggemann, juri.lelli, linux-kernel, mgorman,
mingo, peterz, rostedt, vincent.guittot, vschneid
> -1 is a legal argument for cpumask_next(), and cpumask_next(-1, mask) is
> equivalent to cpumask_first(mask). The explicit check and separate branch
> are unnecessary.
Gentle ping. This patch has been reviewed but not merged yet.
Regards,
Wang.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-06 0:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-07 3:40 [PATCH] sched: remove unnecessary check in sched_{debug_}start() Fushuai Wang
2025-08-19 11:23 ` Valentin Schneider
2025-10-06 0:41 ` Fushuai Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®