mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	KVM: X86: Choose qspinlock when dedicated physical CPUs are available
Waiman Long mentioned that: > Generally speaking, unfair lock performs well for VMs with a small > number of vCPUs. Native qspinlock may perform better than pvqspinlock > if there is vCPU pinning and there is no vCPU over-commitment. This patch uses the KVM_HINTS_DEDICATED performance hint, which is provided by the hypervisor admin, to choose the qspinlock algorithm when a dedicated physical CPU is available. PV_DEDICATED = 1, PV_UNHALT = anything: default is qspinlock PV_DEDICATED = 0, PV_UNHALT = 1: default is Hybrid PV queued/unfair lock PV_DEDICATED = 0, PV_UNHALT = 0: default is tas Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Radim Krčmář <rkrcmar@redhat.com> Cc: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Wanpeng Li <wanpengli@tencent.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
This commit is contained in:
		
							parent
							
								
									a4429e53c9
								
							
						
					
					
						commit
						b2798ba0b8
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
					@ -735,6 +735,11 @@ void __init kvm_spinlock_init(void)
 | 
				
			||||||
	if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT))
 | 
						if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT))
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (kvm_para_has_hint(KVM_HINTS_DEDICATED)) {
 | 
				
			||||||
 | 
							static_branch_disable(&virt_spin_lock_key);
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	__pv_init_lock_hash();
 | 
						__pv_init_lock_hash();
 | 
				
			||||||
	pv_lock_ops.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath;
 | 
						pv_lock_ops.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath;
 | 
				
			||||||
	pv_lock_ops.queued_spin_unlock = PV_CALLEE_SAVE(__pv_queued_spin_unlock);
 | 
						pv_lock_ops.queued_spin_unlock = PV_CALLEE_SAVE(__pv_queued_spin_unlock);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue