diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2009-02-18 08:08:59 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-03-24 05:03:10 -0400 |
commit | 6bed6b9e84bf5e6b468847a50c0751389fdd01d4 (patch) | |
tree | 485f95ce3a1c3053bddf44303c47514a9a0e83ec /arch | |
parent | fc5659c8c6b6c4e02ac354b369017c1bf231f347 (diff) |
KVM: MMU: remove redundant check in mmu_set_spte
The following code flow is unnecessary:
if (largepage)
was_rmapped = is_large_pte(*shadow_pte);
else
was_rmapped = 1;
The is_large_pte() function will always evaluate to one here because the
(largepage && !is_large_pte) case is already handled in the first
if-clause. So we can remove this check and set was_rmapped to one always
here.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kvm/mmu.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index ef060ec444a4..c90b4b2f2abd 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -1791,12 +1791,8 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte, | |||
1791 | pgprintk("hfn old %lx new %lx\n", | 1791 | pgprintk("hfn old %lx new %lx\n", |
1792 | spte_to_pfn(*shadow_pte), pfn); | 1792 | spte_to_pfn(*shadow_pte), pfn); |
1793 | rmap_remove(vcpu->kvm, shadow_pte); | 1793 | rmap_remove(vcpu->kvm, shadow_pte); |
1794 | } else { | 1794 | } else |
1795 | if (largepage) | 1795 | was_rmapped = 1; |
1796 | was_rmapped = is_large_pte(*shadow_pte); | ||
1797 | else | ||
1798 | was_rmapped = 1; | ||
1799 | } | ||
1800 | } | 1796 | } |
1801 | if (set_spte(vcpu, shadow_pte, pte_access, user_fault, write_fault, | 1797 | if (set_spte(vcpu, shadow_pte, pte_access, user_fault, write_fault, |
1802 | dirty, largepage, global, gfn, pfn, speculative, true)) { | 1798 | dirty, largepage, global, gfn, pfn, speculative, true)) { |