summaryrefslogtreecommitdiffstats
path: root/arch/x86/xen/spinlock.c
diff options
context:
space:
mode:
authorWaiman Long <longman@redhat.com>2018-07-19 23:39:57 +0200
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>2018-07-27 05:05:14 +0200
commit47b428d14f06dbeab23dd5c7e424e15283841765 (patch)
tree2305cea8afb27ae05e804c8c8af1e9d394e2a6bf /arch/x86/xen/spinlock.c
parentxen/gntdev: Implement dma-buf import functionality (diff)
downloadlinux-47b428d14f06dbeab23dd5c7e424e15283841765.tar.xz
linux-47b428d14f06dbeab23dd5c7e424e15283841765.zip
xen/spinlock: Don't use pvqspinlock if only 1 vCPU
On a VM with only 1 vCPU, the locking fast paths will always be successful. In this case, there is no need to use the the PV qspinlock code which has higher overhead on the unlock side than the native qspinlock code. The xen_pvspin veriable is also turned off in this 1 vCPU case to eliminate unneeded pvqspinlock initialization in xen_init_lock_cpu() which is run after xen_init_spinlocks(). Signed-off-by: Waiman Long <longman@redhat.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Diffstat (limited to 'arch/x86/xen/spinlock.c')
-rw-r--r--arch/x86/xen/spinlock.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index cd97a62394e7..973f10e05211 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -130,6 +130,10 @@ PV_CALLEE_SAVE_REGS_THUNK(xen_vcpu_stolen);
void __init xen_init_spinlocks(void)
{
+ /* Don't need to use pvqspinlock code if there is only 1 vCPU. */
+ if (num_possible_cpus() == 1)
+ xen_pvspin = false;
+
if (!xen_pvspin) {
printk(KERN_DEBUG "xen: PV spinlocks disabled\n");
return;