mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched/fair: remove redundant se initialization in unthrottle_cfs_rq
@ 2025-11-08  7:38 Linwei Wang
  2025-11-11  7:40 ` Aaron Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Linwei Wang @ 2025-11-08  7:38 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot
  Cc: dietmar.eggemann, rostedt, bsegall, mgorman, vschneid,
	linux-kernel, Linwei Wang

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


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

end of thread, other threads:[~2025-11-12 14:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-08  7:38 [PATCH] sched/fair: remove redundant se initialization in unthrottle_cfs_rq Linwei Wang
2025-11-11  7:40 ` Aaron Lu
2025-11-12 14:21   ` Linwei 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®