public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm mmu: fix another largepage memory leak
@ 2009-02-19 11:18 Joerg Roedel
  2009-02-19 13:20 ` Marcelo Tosatti
  2009-02-23 10:55 ` Avi Kivity
  0 siblings, 2 replies; 3+ messages in thread
From: Joerg Roedel @ 2009-02-19 11:18 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm, linux-kernel, Joerg Roedel

In the paging_fetch function rmap_remove is called after setting a large
pte to non-present. This causes rmap_remove to not drop the reference to
the large page. The result is a memory leak of that page.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 arch/x86/kvm/paging_tmpl.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 7314c09..0f11792 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -306,9 +306,9 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
 			continue;
 
 		if (is_large_pte(*sptep)) {
+			rmap_remove(vcpu->kvm, sptep);
 			set_shadow_pte(sptep, shadow_trap_nonpresent_pte);
 			kvm_flush_remote_tlbs(vcpu->kvm);
-			rmap_remove(vcpu->kvm, sptep);
 		}
 
 		if (level == PT_DIRECTORY_LEVEL
-- 
1.5.6.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kvm mmu: fix another largepage memory leak
  2009-02-19 11:18 [PATCH] kvm mmu: fix another largepage memory leak Joerg Roedel
@ 2009-02-19 13:20 ` Marcelo Tosatti
  2009-02-23 10:55 ` Avi Kivity
  1 sibling, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2009-02-19 13:20 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: Avi Kivity, kvm, linux-kernel


On Thu, Feb 19, 2009 at 12:18:56PM +0100, Joerg Roedel wrote:
> In the paging_fetch function rmap_remove is called after setting a large
> pte to non-present. This causes rmap_remove to not drop the reference to
> the large page. The result is a memory leak of that page.
> 
> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
> ---
>  arch/x86/kvm/paging_tmpl.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
> index 7314c09..0f11792 100644
> --- a/arch/x86/kvm/paging_tmpl.h
> +++ b/arch/x86/kvm/paging_tmpl.h
> @@ -306,9 +306,9 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
>  			continue;
>  
>  		if (is_large_pte(*sptep)) {
> +			rmap_remove(vcpu->kvm, sptep);
>  			set_shadow_pte(sptep, shadow_trap_nonpresent_pte);
>  			kvm_flush_remote_tlbs(vcpu->kvm);
> -			rmap_remove(vcpu->kvm, sptep);
>  		}
>  
>  		if (level == PT_DIRECTORY_LEVEL
> -- 

ACK


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kvm mmu: fix another largepage memory leak
  2009-02-19 11:18 [PATCH] kvm mmu: fix another largepage memory leak Joerg Roedel
  2009-02-19 13:20 ` Marcelo Tosatti
@ 2009-02-23 10:55 ` Avi Kivity
  1 sibling, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2009-02-23 10:55 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: Marcelo Tosatti, kvm, linux-kernel

Joerg Roedel wrote:
> In the paging_fetch function rmap_remove is called after setting a large
> pte to non-present. This causes rmap_remove to not drop the reference to
> the large page. The result is a memory leak of that page.
>
>   

Applied, thanks.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-02-23 10:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-19 11:18 [PATCH] kvm mmu: fix another largepage memory leak Joerg Roedel
2009-02-19 13:20 ` Marcelo Tosatti
2009-02-23 10:55 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox