Re: [PATCH] dentry/inode accounting for vm_enough_mem()

Andrew Morton (akpm@digeo.com)
Tue, 20 May 2003 03:08:24 -0700


Dave Hansen <haveblue@us.ibm.com> wrote:
>
> +void inode_dtor(void * objp, struct kmem_cache_s *cachep, unsigned long dflags)
> +{
> + atomic_dec(&inodes_stat.nr_alloced);
> }

This isn't called anywhere.

inodes are a problem, because their sizes differ, and because each
filesystem uses its own slab cache for them.

I'm wondering if it would not be better to modify slab to do this. For all
the inode caches and the dentry cache and the mb cache and that new
shrinkable cache which just got added to XFS, we can pass a new flag into
kmem_cache_create() which tells slab.c to account for this cache.

So then, in slab.c, it's just a matter of incrementing or decrementing a
global counter each time slab allocates or frees a page on behalf of a
thus-tagged cache. And simply read that counter in vm_enough_memory().

-
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/