Re: 2.6.0-test5/6 (and probably 7 too) size-4096 memory leak

From: Andrew Morton
Date: Thu Oct 16 2003 - 01:30:32 EST


Manfred Spraul <manfred@xxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/