Commit Graph

3 Commits

Author SHA1 Message Date
Mungerjiang 068ddf89ac locking/qspinlock: Introduce CNA into the slow path of qspinlock
In CNA, spinning threads are organized in two queues, a primary queue for
	threads running on the same node as the current lock holder, and a
	secondary queue for threads running on other nodes. After acquiring the
	MCS lock and before acquiring the spinlock, the MCS lock
	holder checks whether the next waiter in the primary queue (if exists) is
	running on the same NUMA node. If it is not, that waiter is detached from
	the main queue and moved into the tail of the secondary queue. This way,
	we gradually filter the primary queue, leaving only waiters running on
	the same preferred NUMA node. For more details, see
	https://arxiv.org/abs/1810.05600.

	Note that this variant of CNA may introduce starvation by continuously
	passing the lock between waiters in the main queue. This issue will be
	addressed later in the series.

	Enabling CNA is controlled via a new configuration option
	(NUMA_AWARE_SPINLOCKS). By default, the CNA variant is patched in at the
	boot time only if we run on a multi-node machine in native environment and
	the new config is enabled. (For the time being, the patching requires
	CONFIG_PARAVIRT_SPINLOCKS to be enabled as well. However, this should be
	resolved once static_call() is available.) This default behavior can be
	overridden with the new kernel boot command-line option
	"numa_spinlock=on/off" (default is "auto").

	Signed-off-by: Alex Kogan <alex.kogan@oracle.com>
	Reviewed-by: Steve Sistare <steven.sistare@oracle.com>
	Reviewed-by: Waiman Long <longman@redhat.com>
2021-12-20 11:43:06 +08:00
Mungerjiang 05e8e4dd54 locking/qspinlock: Rename mcs lock/unlock macros and make them more generic
The mcs unlock macro (arch_mcs_lock_handoff) should accept the value to be
	stored into the lock argument as another argument. This allows using the
	same macro in cases where the value to be stored when passing the lock is
	different from 1.

	Signed-off-by: Alex Kogan <alex.kogan@oracle.com>
	Reviewed-by: Steve Sistare <steven.sistare@oracle.com>
	Reviewed-by: Waiman Long <longman@redhat.com>
2021-12-20 11:43:06 +08:00
Kaixu Xia 590eaf1fec Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces.
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
2021-03-16 11:01:34 +08:00