OSDN Git Service

locking/rtmutex: Add adaptive spinwait mechanism
authorSteven Rostedt <rostedt@goodmis.org>
Sun, 15 Aug 2021 21:29:25 +0000 (23:29 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 17 Aug 2021 17:06:11 +0000 (19:06 +0200)
commit992caf7f17243d736fc996770bac6566103778f6
treeb3782229183ce8c5a02f24d1f28590b7a1f517fe
parent48eb3f4fcfd35495a8357459aa6fe437aa430b00
locking/rtmutex: Add adaptive spinwait mechanism

Going to sleep when locks are contended can be quite inefficient when the
contention time is short and the lock owner is running on a different CPU.

The MCS mechanism cannot be used because MCS is strictly FIFO ordered while
for rtmutex based locks the waiter ordering is priority based.

Provide a simple adaptive spinwait mechanism which currently restricts the
spinning to the top priority waiter.

[ tglx: Provide a contemporary changelog, extended it to all rtmutex based
   locks and updated it to match the other spin on owner implementations ]

Originally-by: Gregory Haskins <ghaskins@novell.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20210815211305.912050691@linutronix.de
kernel/locking/rtmutex.c