From: Linwei Wang <wanix1988@gmail.com>
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org
Cc: dietmar.eggemann@arm.com, rostedt@goodmis.org,
bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
linux-kernel@vger.kernel.org, Linwei Wang <wanix1988@gmail.com>
Subject: [PATCH] sched/fair: remove redundant se initialization in unthrottle_cfs_rq
Date: Sat, 8 Nov 2025 15:38:29 +0800 [thread overview]
Message-ID: <20251108073829.7594-1-wanix1988@gmail.com> (raw)
In unthrottle_cfs_rq(), the variable 'se' is initialized at
declaration (line 6024) but then immediately reassigned at line 6039
after an early return check. This redundant initialization is
wasteful, especially when the function returns early at line 6037.
Remove the redundant initialization and only assign 'se' when it's
actually needed, avoiding unnecessary memory access and improving
code clarity.
Signed-off-by: Linwei Wang <wanix1988@gmail.com>
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 25970dbbb279..67cbb809b9a8 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6021,7 +6021,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq)
{
struct rq *rq = rq_of(cfs_rq);
struct cfs_bandwidth *cfs_b = tg_cfs_bandwidth(cfs_rq->tg);
- struct sched_entity *se = cfs_rq->tg->se[cpu_of(rq)];
+ struct sched_entity *se;
/*
* It's possible we are called with !runtime_remaining due to things
--
2.39.5
next reply other threads:[~2025-11-08 7:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-08 7:38 Linwei Wang [this message]
2025-11-11 7:40 ` Aaron Lu
2025-11-12 14:21 ` Linwei 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=20251108073829.7594-1-wanix1988@gmail.com \
--to=wanix1988@gmail.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®