public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* UML is leaking memory in arch_dup_mmap
@ 2008-01-18 14:42 Miklos Szeredi
  2008-01-18 18:07 ` Jeff Dike
  0 siblings, 1 reply; 3+ messages in thread
From: Miklos Szeredi @ 2008-01-18 14:42 UTC (permalink / raw)
  To: jdike; +Cc: user-mode-linux-devel, linux-kernel

On 2.6.24-rc8-mm1:

uml:~#  grep arch_dup_mmap /proc/slab_allocators
size-32: 10861 arch_dup_mmap+0x9f/0x130

Miklos

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

* Re: UML is leaking memory in arch_dup_mmap
  2008-01-18 14:42 UML is leaking memory in arch_dup_mmap Miklos Szeredi
@ 2008-01-18 18:07 ` Jeff Dike
  2008-01-18 18:29   ` Miklos Szeredi
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Dike @ 2008-01-18 18:07 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: user-mode-linux-devel, linux-kernel

On Fri, Jan 18, 2008 at 03:42:54PM +0100, Miklos Szeredi wrote:
> uml:~#  grep arch_dup_mmap /proc/slab_allocators
> size-32: 10861 arch_dup_mmap+0x9f/0x130

Whoops - try the patch below.

				Jeff

-- 
Work email - jdike at linux dot intel dot com

Index: linux-2.6.22/arch/um/include/um_mmu.h
===================================================================
--- linux-2.6.22.orig/arch/um/include/um_mmu.h	2008-01-17 13:44:49.000000000 -0500
+++ linux-2.6.22/arch/um/include/um_mmu.h	2008-01-18 12:53:10.000000000 -0500
@@ -17,6 +17,7 @@ typedef struct mm_context {
 	unsigned long last_pmd;
 #endif
 	struct uml_ldt ldt;
+	struct page **stub_pages;
 } mm_context_t;
 
 extern void __switch_mm(struct mm_id * mm_idp);
Index: linux-2.6.22/arch/um/kernel/skas/mmu.c
===================================================================
--- linux-2.6.22.orig/arch/um/kernel/skas/mmu.c	2008-01-18 13:02:52.000000000 -0500
+++ linux-2.6.22/arch/um/kernel/skas/mmu.c	2008-01-18 13:04:42.000000000 -0500
@@ -91,6 +91,8 @@ int init_new_context(struct task_struct 
 		goto out_free;
 	}
 
+	to_mm->stub_pages = NULL;
+
 	return 0;
 
  out_free:
@@ -126,6 +128,7 @@ void arch_dup_mmap(struct mm_struct *old
 
 	pages[0] = virt_to_page(&__syscall_stub_start);
 	pages[1] = virt_to_page(mm->context.id.stack);
+	mm->context.stub_pages = pages;
 
 	/* dup_mmap already holds mmap_sem */
 	err = install_special_mapping(mm, STUB_START, STUB_END - STUB_START,
@@ -147,6 +150,8 @@ void arch_exit_mmap(struct mm_struct *mm
 {
 	pte_t *pte;
 
+	if(mm->context.stub_pages != NULL)
+		kfree(mm->context.stub_pages);
 	pte = virt_to_pte(mm, STUB_CODE);
 	if (pte != NULL)
 		pte_clear(mm, STUB_CODE, pte);

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

* Re: UML is leaking memory in arch_dup_mmap
  2008-01-18 18:07 ` Jeff Dike
@ 2008-01-18 18:29   ` Miklos Szeredi
  0 siblings, 0 replies; 3+ messages in thread
From: Miklos Szeredi @ 2008-01-18 18:29 UTC (permalink / raw)
  To: jdike; +Cc: user-mode-linux-devel, linux-kernel

> On Fri, Jan 18, 2008 at 03:42:54PM +0100, Miklos Szeredi wrote:
> > uml:~#  grep arch_dup_mmap /proc/slab_allocators
> > size-32: 10861 arch_dup_mmap+0x9f/0x130
> 
> Whoops - try the patch below.

Yup, that seems to have solved it.  Thanks.

Miklos

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

end of thread, other threads:[~2008-01-18 18:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-18 14:42 UML is leaking memory in arch_dup_mmap Miklos Szeredi
2008-01-18 18:07 ` Jeff Dike
2008-01-18 18:29   ` Miklos Szeredi

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