Re: [PATCH] sched/fair: remove redundant se initialization in unthrottle_cfs_rq

From: Linwei Wang

Date: Wed Nov 12 2025 - 09:21:29 EST


Hi Aaron,

Your commit 956dfda6a708 removes the duplicate assignment after the early
return, but still initializes 'se' at declaration:

struct sched_entity *se = cfs_rq->tg->se[cpu_of(rq)];

This initialization happens before the early return check at line 6036-6037,
so when runtime_remaining <= 0 causes an early return, the array access
is wasted.

My patch defers initialization until after the early return:

- struct sched_entity *se = cfs_rq->tg->se[cpu_of(rq)];
+ struct sched_entity *se;
...
+ se = cfs_rq->tg->se[cpu_of(rq)];

Your commit fixes the duplicate assignment; mine optimizes the early return
path. They're independent optimizations.

Should I rebase on top of 956dfda6a708?

Thanks.