linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] slub: sysfs_slab_remove should free kmem_cache when debug is enabled
@ 2009-07-22  9:03 Xiaotian Feng
  2009-07-22 12:24 ` Christoph Lameter
  0 siblings, 1 reply; 3+ messages in thread
From: Xiaotian Feng @ 2009-07-22  9:03 UTC (permalink / raw)
  To: penberg, cl; +Cc: linux-mm, linux-kernel, Xiaotian Feng

kmem_cache_destroy use sysfs_slab_remove to release the kmem_cache,
but when CONFIG_SLUB_DEBUG is enabled, sysfs_slab_remove just release
related kobject, the whole kmem_cache is missed to release and cause
a memory leak.

Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
---
 mm/slub.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index b9f1491..05b69fd 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4559,6 +4559,7 @@ static void sysfs_slab_remove(struct kmem_cache *s)
 	kobject_uevent(&s->kobj, KOBJ_REMOVE);
 	kobject_del(&s->kobj);
 	kobject_put(&s->kobj);
+	kfree(s);
 }
 
 /*
-- 
1.6.2.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] slub: sysfs_slab_remove should free kmem_cache when debug is enabled
  2009-07-22  9:03 [PATCH] slub: sysfs_slab_remove should free kmem_cache when debug is enabled Xiaotian Feng
@ 2009-07-22 12:24 ` Christoph Lameter
  2009-07-23  9:43   ` Pekka Enberg
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Lameter @ 2009-07-22 12:24 UTC (permalink / raw)
  To: Xiaotian Feng; +Cc: penberg, linux-mm, linux-kernel


Acked-by: Christoph Lameer <cl@linux-foundation.org>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] slub: sysfs_slab_remove should free kmem_cache when debug is enabled
  2009-07-22 12:24 ` Christoph Lameter
@ 2009-07-23  9:43   ` Pekka Enberg
  0 siblings, 0 replies; 3+ messages in thread
From: Pekka Enberg @ 2009-07-23  9:43 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: Xiaotian Feng, linux-mm, linux-kernel

Applied, thanks!

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2009-07-23  9:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-22  9:03 [PATCH] slub: sysfs_slab_remove should free kmem_cache when debug is enabled Xiaotian Feng
2009-07-22 12:24 ` Christoph Lameter
2009-07-23  9:43   ` Pekka Enberg

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