[tip: sched/core] sched: Make raw_spin_rq_unlock() inline
From: tip-bot2 for Xie Yuanbin
Date: Mon Mar 02 2026 - 09:57:02 EST
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 2ad9b46d0a53bcadf2092626fcfd2d96e9b22001
Gitweb: https://git.kernel.org/tip/2ad9b46d0a53bcadf2092626fcfd2d96e9b22001
Author: Xie Yuanbin <qq570070308@xxxxxxxxx>
AuthorDate: Tue, 17 Feb 2026 00:49:49 +08:00
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Mon, 02 Mar 2026 15:41:01 +01:00
sched: Make raw_spin_rq_unlock() inline
raw_spin_rq_unlock() is short, and is called in some hot code paths
such as finish_lock_switch.
Make raw_spin_rq_unlock() inline to optimize performance.
Signed-off-by: Xie Yuanbin <qq570070308@xxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Link: https://patch.msgid.link/20260216164950.147617-3-qq570070308@xxxxxxxxx
---
kernel/sched/core.c | 5 -----
kernel/sched/sched.h | 9 ++++++---
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 1e6ebc2..c39e9b4 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -687,11 +687,6 @@ bool raw_spin_rq_trylock(struct rq *rq)
}
}
-void raw_spin_rq_unlock(struct rq *rq)
-{
- raw_spin_unlock(rq_lockp(rq));
-}
-
/*
* double_rq_lock - safely lock two runqueues
*/
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index fbde83c..fd36ae3 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1609,15 +1609,18 @@ extern void raw_spin_rq_lock_nested(struct rq *rq, int subclass)
extern bool raw_spin_rq_trylock(struct rq *rq)
__cond_acquires(true, __rq_lockp(rq));
-extern void raw_spin_rq_unlock(struct rq *rq)
- __releases(__rq_lockp(rq));
-
static inline void raw_spin_rq_lock(struct rq *rq)
__acquires(__rq_lockp(rq))
{
raw_spin_rq_lock_nested(rq, 0);
}
+static inline void raw_spin_rq_unlock(struct rq *rq)
+ __releases(__rq_lockp(rq))
+{
+ raw_spin_unlock(rq_lockp(rq));
+}
+
static inline void raw_spin_rq_lock_irq(struct rq *rq)
__acquires(__rq_lockp(rq))
{