kvm: ppc: stop leaking host memory on VM exit
Subsystems (3)
PATCH 1/1 kvm: ppc: stop leaking host memory on VM exit
When the VM exits, we must call put_page() for every page referenced in the shadow TLB.
Without this patch, we usually leak 30-50 host pages (120 - 200 KiB with 4 KiB pages). The maximum number of pages leaked is the size of our shadow TLB, 64 pages.
---
The obvious question is "why didn't we see this before?" Basically, we'd never looked for it, and since most of our work was in the kernel we always ended up rebooting before exhausting host memory.
Since it's such a large leak, and a simple fix, please commit this for 2.6.28. This patch does apply to kvm.git with fuzz, but if you prefer I can send a separate patch for that later.
arch/powerpc/include/asm/kvm_ppc.h +2 -0
@@ -104,4 +104,6 @@ static inline void kvmppc_set_pid(struct } } +extern void kvmppc_core_destroy_mmu (struct kvm_vcpu *vcpu); +#endif /* __POWERPC_KVM_PPC_H__ */
arch/powerpc/kvm/44x_tlb.c +8 -0
@@ -124,6 +124,14 @@ static void kvmppc_44x_shadow_release(st } } +void kvmppc_core_destroy_mmu (struct kvm_vcpu *vcpu) +{ +int i; + +for (i =0 ; i <= tlb_44x_hwater; i++) +kvmppc_44x_shadow_release (vcpu, i); +} +void kvmppc_tlbe_set_modified (struct kvm_vcpu *vcpu,unsigned int i) { vcpu->arch.shadow_tlb_mod[i] =1 ;
arch/powerpc/kvm/powerpc.c +1 -0
@@ -238,6 +238,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *void kvm_arch_vcpu_uninit (struct kvm_vcpu *vcpu) { +kvmppc_core_destroy_mmu (vcpu); }/* Note: clearing MSR[DE] just means that the debug interrupt will not be
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center
A message that is not in the archive (sent off-list or not yet received): 1227548258.17746.11.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]
Good catch.
Quoted 26 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Hollis Blanchard
Sent: Tuesday, November 25, 2008 1:38 AM
To: Avi Kivity
Cc: kvm-ppc; kvm
Subject: [PATCH] kvm: ppc: stop leaking host memory on VM exitWhen the VM exits, we must call
put_page()for every page referenced in the
shadow TLB.Without this patch, we usually leak 30-50 host pages (120 - 200 KiB with 4 KiB
pages). The maximum number of pages leaked is the size of our shadow TLB, 64
pages.Signed-off-by Hollis Blanchard <hollisb-r/[email protected]>---
The obvious question is "why didn't we see this before?" Basically, we'd never
looked for it, and since most of our work was in the kernel we always ended up
rebooting before exhausting host memory.
Quoted 6 lines
Since it's such a large leak, and a simple fix, please commit this for 2.6.28.
This patch does apply to kvm.git with fuzz, but if you prefer I can send a
separate patch for that later.
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 12 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Hollis Blanchard
Sent: Tuesday, November 25, 2008 1:38 AM
To: Avi Kivity
Cc: kvm-ppc; kvm
Subject: [PATCH] kvm: ppc: stop leaking host memory on VM exitWhen the VM exits, we must call
put_page()for every page referenced in the
shadow TLB.
Quoted 7 lines
Without this patch, we usually leak 30-50 host pages (120 - 200 KiB with 4 KiB
pages). The maximum number of pages leaked is the size of our shadow TLB, 64
pages.Signed-off-by Hollis Blanchard <[email protected]>
Need it also to _tlbia() at vcpu_uninit?
A message that is not in the archive (sent off-list or not yet received): D8176E55B81822498D63816C4ADC701023423D-bKEhWGtIRUJ4Lp7cDGe+DVjVikpgYyvb5NbjCUgZEJk@public.gmane.org
Quoted 18 lines · Liu Yu
Quoted 18 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Hollis Blanchard
Sent: Tuesday, November 25, 2008 1:38 AM
To: Avi Kivity
Cc: kvm-ppc; kvm
Subject: [PATCH] kvm: ppc: stop leaking host memory on VM exitWhen the VM exits, we must call
put_page()for every page referenced in the
shadow TLB.Without this patch, we usually leak 30-50 host pages (120 - 200 KiB with 4 KiB
pages). The maximum number of pages leaked is the size of our shadow TLB, 64
pages.
Quoted 3 lines
Quoted 1 line
Signed-off-by Hollis Blanchard <hollisb-r/[email protected]>Need it also to
_tlbia()atvcpu_uninit?
No, because by the time we hit kvm_arch_vcpu_uninit(), kvm_arch_vcpu_put() has already been called.
Signature · 7 lines
Hollis Blanchard IBM Linux Technology Center -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Hollis Blanchard
When the VM exits, we must call
put_page()for every page referenced in the shadow TLB.Without this patch, we usually leak 30-50 host pages (120 - 200 KiB with 4 KiB pages). The maximum number of pages leaked is the size of our shadow TLB, 64 pages.
Signed-off-by Hollis Blanchard <[email protected]>
Quoted 9 lines
---
The obvious question is "why didn't we see this before?" Basically, we'd never looked for it, and since most of our work was in the kernel we always ended up rebooting before exhausting host memory.Since it's such a large leak, and a simple fix, please commit this for 2.6.28. This patch does apply to kvm.git with fuzz, but if you prefer I can send a separate patch for that later.
Applied on both master and the 2.6.28 queue.
Signature · 1 line
error compiling committee.c: too many arguments to function