* slub: Dump list of objects not freed on kmem_cache_close()
@ 2008-04-25 19:22 Christoph Lameter
2008-04-27 10:00 ` Pekka Enberg
0 siblings, 1 reply; 2+ messages in thread
From: Christoph Lameter @ 2008-04-25 19:22 UTC (permalink / raw)
To: Pekka Enberg; +Cc: linux-mm
Dump a list of unfreed objects if a slab cache is closed but
objects still remain.
[Untested (straight use of the logic from process_slab()), may conflict
with the other patch you just committed]
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
mm/slub.c | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
Index: linux-2.6/mm/slub.c
===================================================================
--- linux-2.6.orig/mm/slub.c 2008-04-24 23:17:51.719890166 -0700
+++ linux-2.6/mm/slub.c 2008-04-24 23:19:03.139899059 -0700
@@ -2418,6 +2418,32 @@ const char *kmem_cache_name(struct kmem_
}
EXPORT_SYMBOL(kmem_cache_name);
+static void list_slab_objects(struct kmem_cache *s, struct page *page,
+ const char *text)
+{
+#ifdef CONFIG_SLUB_DEBUG
+ void *addr = page_address(page);
+ void *p;
+ DECLARE_BITMAP(map, page->objects);
+
+ bitmap_zero(map, page->objects);
+ slab_err(s, page, "%s", text);
+ slab_lock(page);
+ for_each_free_object(p, s, page->freelist)
+ set_bit(slab_index(p, s, addr), map);
+
+ for_each_object(p, s, addr, page->objects) {
+
+ if (!test_bit(slab_index(p, s, addr), map)) {
+ printk(KERN_ERR "INFO: Object 0x%p @offset=%tu\n",
+ p, p - addr);
+ print_tracking(s, p);
+ }
+ }
+ slab_unlock(page);
+#endif
+}
+
/*
* Attempt to free all slabs on a node. Return the number of slabs we
* were unable to free.
@@ -2434,8 +2460,11 @@ static int free_list(struct kmem_cache *
if (!page->inuse) {
list_del(&page->lru);
discard_slab(s, page);
- } else
+ } else {
slabs_inuse++;
+ list_slab_objects(s, page,
+ "Objects remaining on kmem_cache_close()");
+ }
spin_unlock_irqrestore(&n->list_lock, flags);
return slabs_inuse;
}
--
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] 2+ messages in thread
* Re: slub: Dump list of objects not freed on kmem_cache_close()
2008-04-25 19:22 slub: Dump list of objects not freed on kmem_cache_close() Christoph Lameter
@ 2008-04-27 10:00 ` Pekka Enberg
0 siblings, 0 replies; 2+ messages in thread
From: Pekka Enberg @ 2008-04-27 10:00 UTC (permalink / raw)
To: Christoph Lameter; +Cc: linux-mm
Christoph Lameter wrote:
> Dump a list of unfreed objects if a slab cache is closed but
> objects still remain.
>
> [Untested (straight use of the logic from process_slab()), may conflict
> with the other patch you just committed]
>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
It conflicted with the free_list() cleanup but I fixed that up. 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] 2+ messages in thread
end of thread, other threads:[~2008-04-27 10:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-25 19:22 slub: Dump list of objects not freed on kmem_cache_close() Christoph Lameter
2008-04-27 10:00 ` Pekka Enberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox