mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] sched: Simplify sched_set_rq_online()
@ 2024-08-28  9:03 Yang Yingliang
  2024-08-28 13:36 ` [PATCH] " Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2024-08-28  9:03 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, vschneid, Markus.Elfring,
	yangyingliang, liwei391

From: Yang Yingliang <yangyingliang@huawei.com>

Use guards to simplify sched_set_rq_online()

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 kernel/sched/core.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index a81b5136d4cb..80848f219260 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7999,26 +7999,20 @@ void set_rq_offline(struct rq *rq)
 
 static inline void sched_set_rq_online(struct rq *rq, int cpu)
 {
-	struct rq_flags rf;
-
-	rq_lock_irqsave(rq, &rf);
+	guard(rq_lock_irqsave)(rq);
 	if (rq->rd) {
 		BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span));
 		set_rq_online(rq);
 	}
-	rq_unlock_irqrestore(rq, &rf);
 }
 
 static inline void sched_set_rq_offline(struct rq *rq, int cpu)
 {
-	struct rq_flags rf;
-
-	rq_lock_irqsave(rq, &rf);
+	guard(rq_lock_irqsave)(rq);
 	if (rq->rd) {
 		BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span));
 		set_rq_offline(rq);
 	}
-	rq_unlock_irqrestore(rq, &rf);
 }
 
 /*
-- 
2.33.0


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

end of thread, other threads:[~2024-08-28 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-28  9:03 [PATCH -next] sched: Simplify sched_set_rq_online() Yang Yingliang
2024-08-28 13:36 ` [PATCH] " Markus Elfring

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®