[PATCH 2/2] sched/fair: Convert rq_lock_irq() to guard()

From: Li kunyu

Date: Wed Nov 18 2026 - 01:17:52 EST


In fair.c, convert the rq_lock_irq()/rq_unlock_irq() pair in
online_fair_sched_group() to guard(rq_lock_irq)(rq). This removes the
now-unnecessary rq_flags local, as the guard helper manages the rq_flags
storage automatically.

In __active_load_balance_cpu_stop(), the rq_lock_irq() call is left as
open-coded, since its unlock path is interleaved with IRQ state
management and does not align cleanly with a scoped guard.

Signed-off-by: Li kunyu <likunyu@xxxxxxxxxxxxxx>
---
kernel/sched/fair.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 1e128214f2e9..2d9927ef8479 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -15671,18 +15671,16 @@ int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
void online_fair_sched_group(struct task_group *tg)
{
struct sched_entity *se;
- struct rq_flags rf;
struct rq *rq;
int i;

for_each_possible_cpu(i) {
rq = cpu_rq(i);
se = tg_se(tg, i);
- rq_lock_irq(rq, &rf);
+ guard(rq_lock_irq)(rq);
update_rq_clock(rq);
attach_entity_cfs_rq(se);
sync_throttle(tg, i);
- rq_unlock_irq(rq, &rf);
}
}

--
2.47.3