diff options
author | Jason Low <jason.low2@hp.com> | 2014-01-28 11:13:13 -0800 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-03-11 12:14:53 +0100 |
commit | 47667fa1502e4d759df87e9cc7fbc0f202483361 (patch) | |
tree | d2355a95e004334147e00650ec4d638389d1ab87 /include/linux/mutex.h | |
parent | 46af29e479cc0c1c63633007993af5292c2c3e75 (diff) | |
download | op-kernel-dev-47667fa1502e4d759df87e9cc7fbc0f202483361.zip op-kernel-dev-47667fa1502e4d759df87e9cc7fbc0f202483361.tar.gz |
locking/mutexes: Modify the way optimistic spinners are queued
The mutex->spin_mlock was introduced in order to ensure that only 1 thread
spins for lock acquisition at a time to reduce cache line contention. When
lock->owner is NULL and the lock->count is still not 1, the spinner(s) will
continually release and obtain the lock->spin_mlock. This can generate
quite a bit of overhead/contention, and also might just delay the spinner
from getting the lock.
This patch modifies the way optimistic spinners are queued by queuing before
entering the optimistic spinning loop as oppose to acquiring before every
call to mutex_spin_on_owner(). So in situations where the spinner requires
a few extra spins before obtaining the lock, then there will only be 1 spinner
trying to get the lock and it will avoid the overhead from unnecessarily
unlocking and locking the spin_mlock.
Signed-off-by: Jason Low <jason.low2@hp.com>
Cc: tglx@linutronix.de
Cc: riel@redhat.com
Cc: akpm@linux-foundation.org
Cc: davidlohr@hp.com
Cc: hpa@zytor.com
Cc: andi@firstfloor.org
Cc: aswin@hp.com
Cc: scott.norton@hp.com
Cc: chegu_vinod@hp.com
Cc: Waiman.Long@hp.com
Cc: paulmck@linux.vnet.ibm.com
Cc: torvalds@linux-foundation.org
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1390936396-3962-3-git-send-email-jason.low2@hp.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/mutex.h')
0 files changed, 0 insertions, 0 deletions