Message ID | 20200121223157.15263-12-sean.j.christopherson@intel.com |
---|---|
State | Not Applicable |
Headers | show |
Series | [v5,01/19] KVM: x86: Allocate new rmap and large page tracking when moving memslot | expand |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index a9d2d9decbc3..cd7af962accf 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -9974,6 +9974,10 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, */ if (change != KVM_MR_DELETE) kvm_mmu_slot_apply_flags(kvm, (struct kvm_memory_slot *) new); + + /* Free the arrays associated with the old memslot. */ + if (change == KVM_MR_MOVE) + kvm_arch_free_memslot(kvm, old, NULL); } void kvm_arch_flush_shadow_all(struct kvm *kvm)