public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM:make cpuid_entry2_find more efficient
@ 2022-08-09  5:51 Liam Ni
  2022-08-09  7:54 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: Liam Ni @ 2022-08-09  5:51 UTC (permalink / raw)
  To: seanjc, pbonzini, tglx, mingo, bp, dave.hansen, hpa
  Cc: x86, kvm, linux-kernel, zhiguangni01

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-09  7:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-09  5:51 [PATCH] KVM:make cpuid_entry2_find more efficient Liam Ni
2022-08-09  7:54 ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox