Skip to content

Commit 7d6c90b

Browse files
atomic-kernel1Naim
authored andcommitted
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. Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@kernel.org> Cc: Rik van Riel <riel@surriel.com> Cc: Segher Boessenkool <segher@kernel.crashing.org> Cc: David Hildenbrand (Red Hat) <david@kernel.org> Cc: H. Peter Anvin (Intel) <hpa@zytor.com> Signed-off-by: Xie Yuanbin <qq570070308@gmail.com>
1 parent 35b9e0c commit 7d6c90b

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

kernel/sched/core.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -686,11 +686,6 @@ bool raw_spin_rq_trylock(struct rq *rq)
686686
}
687687
}
688688

689-
void raw_spin_rq_unlock(struct rq *rq)
690-
{
691-
raw_spin_unlock(rq_lockp(rq));
692-
}
693-
694689
/*
695690
* double_rq_lock - safely lock two runqueues
696691
*/

kernel/sched/sched.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,15 +1602,18 @@ extern void raw_spin_rq_lock_nested(struct rq *rq, int subclass)
16021602
extern bool raw_spin_rq_trylock(struct rq *rq)
16031603
__cond_acquires(true, __rq_lockp(rq));
16041604

1605-
extern void raw_spin_rq_unlock(struct rq *rq)
1606-
__releases(__rq_lockp(rq));
1607-
16081605
static inline void raw_spin_rq_lock(struct rq *rq)
16091606
__acquires(__rq_lockp(rq))
16101607
{
16111608
raw_spin_rq_lock_nested(rq, 0);
16121609
}
16131610

1611+
static inline void raw_spin_rq_unlock(struct rq *rq)
1612+
__releases(__rq_lockp(rq))
1613+
{
1614+
raw_spin_unlock(rq_lockp(rq));
1615+
}
1616+
16141617
static inline void raw_spin_rq_lock_irq(struct rq *rq)
16151618
__acquires(__rq_lockp(rq))
16161619
{

0 commit comments

Comments
 (0)