Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6bed6b9e authored by Joerg Roedel's avatar Joerg Roedel Committed by Avi Kivity
Browse files

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: default avatarJoerg Roedel <joerg.roedel@amd.com>
Acked-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent fc5659c8
Loading
Loading
Loading
Loading
+2 −6
Original line number Original line Diff line number Diff line
@@ -1791,13 +1791,9 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte,
			pgprintk("hfn old %lx new %lx\n",
			pgprintk("hfn old %lx new %lx\n",
				 spte_to_pfn(*shadow_pte), pfn);
				 spte_to_pfn(*shadow_pte), pfn);
			rmap_remove(vcpu->kvm, shadow_pte);
			rmap_remove(vcpu->kvm, shadow_pte);
		} else {
		} else
			if (largepage)
				was_rmapped = is_large_pte(*shadow_pte);
			else
			was_rmapped = 1;
			was_rmapped = 1;
	}
	}
	}
	if (set_spte(vcpu, shadow_pte, pte_access, user_fault, write_fault,
	if (set_spte(vcpu, shadow_pte, pte_access, user_fault, write_fault,
		      dirty, largepage, global, gfn, pfn, speculative, true)) {
		      dirty, largepage, global, gfn, pfn, speculative, true)) {
		if (write_fault)
		if (write_fault)