lkml.org 
[lkml]   [2022]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] KVM:make cpuid_entry2_find more efficient
Date
Compared with the way of obtaining the pointer by
fetching the value of the array and then fetching the pointer,
the way of obtaining the pointer by the pointer offset is more efficient.

Signed-off-by: Liam Ni <zhiguangni01@gmail.com>
---
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 de6d44e07e34..3bf82a891564 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -75,7 +75,7 @@ static inline struct kvm_cpuid_entry2 *cpuid_entry2_find(
int i;

for (i = 0; i < nent; i++) {
- e = &entries[i];
+ e = entries + i;

if (e->function == function &&
(!(e->flags & KVM_CPUID_FLAG_SIGNIFCANT_INDEX) || e->index == index))
--
2.25.1
\
 
 \ /
  Last update: 2022-08-09 07:52    [W:0.067 / U:1.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site