[1/2] kvm: x86: add likely to sched_info_on()
diff mbox series

Message ID 1562240775-16086-2-git-send-email-wang.yi59@zte.com.cn
State New
Headers show
Series
  • fix likely hint of sched_info_on()
Related show

Commit Message

Yi Wang July 4, 2019, 11:46 a.m. UTC
The condition to test is likely() to be true when make defconfig.
Add the hint.

Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
---
 arch/x86/kvm/cpuid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paolo Bonzini July 4, 2019, 12:15 p.m. UTC | #1
On 04/07/19 13:46, Yi Wang wrote:
> The condition to test is likely() to be true when make defconfig.
> Add the hint.
> 
> Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
> ---
>  arch/x86/kvm/cpuid.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 4992e7c..64fff41 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -642,7 +642,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
>  			     (1 << KVM_FEATURE_ASYNC_PF_VMEXIT) |
>  			     (1 << KVM_FEATURE_PV_SEND_IPI);
>  
> -		if (sched_info_on())
> +		if (likely(sched_info_on()))
>  			entry->eax |= (1 << KVM_FEATURE_STEAL_TIME);

This is not a fast path, so adding likely/unlikely is unnecessary.

Paolo

>  		entry->ebx = 0;
>

Patch
diff mbox series

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 4992e7c..64fff41 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -642,7 +642,7 @@  static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 			     (1 << KVM_FEATURE_ASYNC_PF_VMEXIT) |
 			     (1 << KVM_FEATURE_PV_SEND_IPI);
 
-		if (sched_info_on())
+		if (likely(sched_info_on()))
 			entry->eax |= (1 << KVM_FEATURE_STEAL_TIME);
 
 		entry->ebx = 0;