lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240828090336.905676-1-yangyingliang@huaweicloud.com>
Date: Wed, 28 Aug 2024 17:03:36 +0800
From: Yang Yingliang <yangyingliang@...weicloud.com>
To: linux-kernel@...r.kernel.org
Cc: mingo@...hat.com,
	peterz@...radead.org,
	juri.lelli@...hat.com,
	vincent.guittot@...aro.org,
	dietmar.eggemann@....com,
	rostedt@...dmis.org,
	bsegall@...gle.com,
	mgorman@...e.de,
	vschneid@...hat.com,
	Markus.Elfring@....de,
	yangyingliang@...wei.com,
	liwei391@...wei.com
Subject: [PATCH -next] sched: Simplify sched_set_rq_online()

From: Yang Yingliang <yangyingliang@...wei.com>

Use guards to simplify sched_set_rq_online()

Signed-off-by: Yang Yingliang <yangyingliang@...wei.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ