diff options
author | Avi Kivity <avi@qumranet.com> | 2007-01-05 19:36:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2007-01-06 02:55:27 -0500 |
commit | f51234c2cd3ab8bed836e09686e27877e1b55f2a (patch) | |
tree | fbdfbfaf5d7b9c80a105d15b28d600653661572b | |
parent | 143646567f6dcd584e1ab359b5ec83e0545e70cf (diff) |
[PATCH] KVM: MMU: Free pages on kvm destruction
Because mmu pages have attached rmap and parent pte chain structures, we need
to zap them before freeing so the attached structures are freed.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/kvm/mmu.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c index f16321498093..0bd2a19709ce 100644 --- a/drivers/kvm/mmu.c +++ b/drivers/kvm/mmu.c | |||
@@ -1065,9 +1065,14 @@ EXPORT_SYMBOL_GPL(kvm_mmu_free_some_pages); | |||
1065 | 1065 | ||
1066 | static void free_mmu_pages(struct kvm_vcpu *vcpu) | 1066 | static void free_mmu_pages(struct kvm_vcpu *vcpu) |
1067 | { | 1067 | { |
1068 | while (!list_empty(&vcpu->free_pages)) { | 1068 | struct kvm_mmu_page *page; |
1069 | struct kvm_mmu_page *page; | ||
1070 | 1069 | ||
1070 | while (!list_empty(&vcpu->kvm->active_mmu_pages)) { | ||
1071 | page = container_of(vcpu->kvm->active_mmu_pages.next, | ||
1072 | struct kvm_mmu_page, link); | ||
1073 | kvm_mmu_zap_page(vcpu, page); | ||
1074 | } | ||
1075 | while (!list_empty(&vcpu->free_pages)) { | ||
1071 | page = list_entry(vcpu->free_pages.next, | 1076 | page = list_entry(vcpu->free_pages.next, |
1072 | struct kvm_mmu_page, link); | 1077 | struct kvm_mmu_page, link); |
1073 | list_del(&page->link); | 1078 | list_del(&page->link); |