[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251108073829.7594-1-wanix1988@gmail.com>
Date: Sat, 8 Nov 2025 15:38:29 +0800
From: Linwei Wang <wanix1988@...il.com>
To: mingo@...hat.com,
peterz@...radead.org,
juri.lelli@...hat.com,
vincent.guittot@...aro.org
Cc: dietmar.eggemann@....com,
rostedt@...dmis.org,
bsegall@...gle.com,
mgorman@...e.de,
vschneid@...hat.com,
linux-kernel@...r.kernel.org,
Linwei Wang <wanix1988@...il.com>
Subject: [PATCH] sched/fair: remove redundant se initialization in unthrottle_cfs_rq
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@...il.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
Powered by blists - more mailing lists