From: Fushuai Wang <wangfushuai@baidu.com>
To: <linux-kernel@vger.kernel.org>
Cc: <vschneid@redhat.com>, <mgorman@suse.de>, <bsegall@google.com>,
<rostedt@goodmis.org>, <dietmar.eggemann@arm.com>,
<vincent.guittot@linaro.org>, <juri.lelli@redhat.com>,
<peterz@infradead.org>, <mingo@redhat.com>,
Fushuai Wang <wangfushuai@baidu.com>
Subject: [PATCH] sched: remove unnecessary check in sched_{debug_}start()
Date: Thu, 7 Aug 2025 11:40:16 +0800 [thread overview]
Message-ID: <20250807034016.43446-1-wangfushuai@baidu.com> (raw)
-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
next reply other threads:[~2025-08-07 3:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-07 3:40 Fushuai Wang [this message]
2025-08-19 11:23 ` Valentin Schneider
2025-10-06 0:41 ` Fushuai Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250807034016.43446-1-wangfushuai@baidu.com \
--to=wangfushuai@baidu.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®