Skip to contentSkip to conversation

KVM: MMU: fix largepage shadow accounting with oos

PATCH Applied Marcelo Tosatti 2 participants 2 messages Sep 25, 2008 – Sep 27, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

There's no need to increase the largepage shadow count when syncing since there's no count decrement on unsync, only on destruction.

arch/x86/kvm/mmu.c +3 -3
Index: kvm/arch/x86/kvm/mmu.c
===================================================================
@@ -661,8 +661,6 @@ static void rmap_write_protect(struct kv
 
 	if (write_protected)
 		kvm_flush_remote_tlbs(kvm);
-
-	account_shadowed(kvm, gfn);
 }
 
 static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp)
@@ -1130,8 +1128,10 @@ static struct kvm_mmu_page *kvm_mmu_get_
 	sp->gfn = gfn;
 	sp->role = role;
 	hlist_add_head(&sp->hash_link, bucket);
-	if (!metaphysical)
+	if (!metaphysical) {
 		rmap_write_protect(vcpu->kvm, gfn);
+		account_shadowed(vcpu->kvm, gfn);
+	}
 	if (shadow_trap_nonpresent_pte != shadow_notrap_nonpresent_pte)
 		vcpu->arch.mmu.prefetch_page(vcpu, sp);
 	else
Applied
#1 lore raw
Quoted 4 lines · Marcelo Tosatti

There's no need to increase the largepage shadow count when syncing since there's no count decrement on unsync, only on destruction.

Applied, thanks.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.