https://github.com/torvalds/linux
Revision ae7eae9e031206bde8645d038c76ad89e7d3fbcb authored by Vineet Gupta on 14 July 2015, 12:25:05 UTC, committed by Vineet Gupta on 04 August 2015, 03:56:33 UTC
Current spin_lock uses EXchange instruction to implement the atomic test
and set of lock location (reads orig value and ST 1). This however forces
the cacheline into exclusive state (because of the ST) and concurrent
loops in multiple cores will bounce the line around between cores.

Instead, use LLOCK/SCOND to implement the atomic test and set which is
better as line is in shared state while lock is spinning on LLOCK

The real motivation of this change however is to make way for future
changes in atomics to implement delayed retry (with backoff).
Initial experiment with delayed retry in atomics combined with orig
EX based spinlock was a total disaster (broke even LMBench) as
struct sock has a cache line sharing an atomic_t and spinlock. The
tight spinning on lock, caused the atomic retry to keep backing off
such that it would never finish.

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
1 parent 8ac0665
Raw File
Tip revision: ae7eae9e031206bde8645d038c76ad89e7d3fbcb authored by Vineet Gupta on 14 July 2015, 12:25:05 UTC
ARC: LLOCK/SCOND based spin_lock
Tip revision: ae7eae9
Kconfig
#
# For a description of the syntax of this configuration file,
# see Documentation/kbuild/kconfig-language.txt.
#
mainmenu "Linux/$ARCH $KERNELVERSION Kernel Configuration"

config SRCARCH
	string
	option env="SRCARCH"

source "arch/$SRCARCH/Kconfig"
back to top