lkml.org 
[lkml]   [2003]   [Oct]   [16]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateWed, 15 Oct 2003 23:31:02 -0700
FromAndrew Morton <>
SubjectRe: 2.6.0-test5/6 (and probably 7 too) size-4096 memory leak
Manfred Spraul <manfred@colorfullife.com> wrote:
>> I've attached something: with the patch applied, `echo "size-4096 0 0 0" 
>   > /proc/slabinfo` dumps all caller addresses.

Awesome, thanks.

I added some tweaks (why was it returning -EINVAL?).

Is there any reason why we shouldn't merge this up?



 mm/slab.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
diff -puN mm/slab.c~slab-leak-detector-tweaks mm/slab.c
--- 25/mm/slab.c~slab-leak-detector-tweaks	2003-10-15 23:11:19.000000000 -0700
+++ 25-akpm/mm/slab.c	2003-10-15 23:17:12.000000000 -0700
@@ -2708,6 +2708,7 @@ struct seq_operations slabinfo_op = {
 
 static void do_dump_slabp(kmem_cache_t *cachep)
 {
+#if DEBUG
 	struct list_head *q;
 
 	check_irq_on();
@@ -2716,10 +2717,17 @@ static void do_dump_slabp(kmem_cache_t *
 		struct slab *slabp;
 		int i;
 		slabp = list_entry(q, struct slab, list);
-		for (i=0;i<cachep->num;i++)
-			printk(KERN_DEBUG "obj %p/%d: %p\n", slabp, i, (void*)(slab_bufctl(slabp)[i]));
+		for (i = 0; i < cachep->num; i++) {
+			unsigned long sym = slab_bufctl(slabp)[i];
+
+			printk(KERN_DEBUG "obj %p/%d: %p",
+					slabp, i, (void *)sym);
+			print_symbol(" <%s>", sym);
+			printk("\n");
+		}
 	}
 	spin_unlock_irq(&cachep->spinlock);
+#endif
 }
 
 #define MAX_SLABINFO_WRITE 128
@@ -2763,9 +2771,10 @@ ssize_t slabinfo_write(struct file *file
 			    batchcount > limit ||
 			    shared < 0) {
 				do_dump_slabp(cachep);
-				res = -EINVAL;
+				res = 0;
 			} else {
-				res = do_tune_cpucache(cachep, limit, batchcount, shared);
+				res = do_tune_cpucache(cachep, limit,
+							batchcount, shared);
 			}
 			break;
 		}
_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:49    [from the cache]
©2003-2008