KVM: x86/mmu: Skip calling mmu->sync_spte() when the spte is 0
authorLai Jiangshan <jiangshan.ljs@antgroup.com>
Thu, 16 Feb 2023 23:53:21 +0000 (07:53 +0800)
committerSean Christopherson <seanjc@google.com>
Fri, 17 Mar 2023 00:19:55 +0000 (17:19 -0700)
commit19ace7d6ca15a4395dd294286fe253a233bbf20a
tree561f8006db35587c221c9cbf01daa1dc9d5b659d
parent91ca7672dc7386c0d181ead2e03f4e65b73ca6b8
KVM: x86/mmu: Skip calling mmu->sync_spte() when the spte is 0

Sync the spte only when the spte is set and avoid the indirect branch.

Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com>
Link: https://lore.kernel.org/r/20230216235321.735214-5-jiangshanlai@gmail.com
[sean: add wrapper instead of open coding each check]
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/paging_tmpl.h