]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
KVM: MMU: Separate the code for unlinking a shadow page from its parents
authorAvi Kivity <avi@qumranet.com>
Fri, 11 Jul 2008 14:59:46 +0000 (17:59 +0300)
committerAvi Kivity <avi@qumranet.com>
Wed, 15 Oct 2008 08:15:12 +0000 (10:15 +0200)
Place into own function, in preparation for further cleanups.

Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/x86/kvm/mmu.c

index 3da2508eb22a2d9577a0a24847065af3e21acbcc..81016a3a6fd381b81fda15b5994da377a7830d20 100644 (file)
@@ -991,11 +991,10 @@ static void kvm_mmu_reset_last_pte_updated(struct kvm *kvm)
                        kvm->vcpus[i]->arch.last_pte_updated = NULL;
 }
 
-static void kvm_mmu_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp)
+static void kvm_mmu_unlink_parents(struct kvm *kvm, struct kvm_mmu_page *sp)
 {
        u64 *parent_pte;
 
-       ++kvm->stat.mmu_shadow_zapped;
        while (sp->multimapped || sp->parent_pte) {
                if (!sp->multimapped)
                        parent_pte = sp->parent_pte;
@@ -1010,7 +1009,13 @@ static void kvm_mmu_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp)
                kvm_mmu_put_page(sp, parent_pte);
                set_shadow_pte(parent_pte, shadow_trap_nonpresent_pte);
        }
+}
+
+static void kvm_mmu_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp)
+{
+       ++kvm->stat.mmu_shadow_zapped;
        kvm_mmu_page_unlink_children(kvm, sp);
+       kvm_mmu_unlink_parents(kvm, sp);
        if (!sp->root_count) {
                if (!sp->role.metaphysical && !sp->role.invalid)
                        unaccount_shadowed(kvm, sp->gfn);