Skip to content

Commit 0dceeaf

Browse files
Pan Xinhuiingomolnar
authored andcommitted
locking/qspinlock: Use __this_cpu_dec() instead of full-blown this_cpu_dec()
queued_spin_lock_slowpath() should not worry about another queued_spin_lock_slowpath() running in interrupt context and changing node->count by accident, because node->count keeps the same value every time we enter/leave queued_spin_lock_slowpath(). On some architectures this_cpu_dec() will save/restore irq flags, which has high overhead. Use the much cheaper __this_cpu_dec() instead. Signed-off-by: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Waiman.Long@hpe.com Link: http://lkml.kernel.org/r/1465886247-3773-1-git-send-email-xinhui.pan@linux.vnet.ibm.com [ Rewrote changelog. ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent ebff09a commit 0dceeaf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎kernel/locking/qspinlock.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ void queued_spin_lock_slowpath(struct qspinlock *lock, u32 val)
619619
/*
620620
* release the node
621621
*/
622-
this_cpu_dec(mcs_nodes[0].count);
622+
__this_cpu_dec(mcs_nodes[0].count);
623623
}
624624
EXPORT_SYMBOL(queued_spin_lock_slowpath);
625625

0 commit comments

Comments
 (0)