Re: [RFC-PATCH] nfs client enhancements

Steve Dodd (dirk@loth.demon.co.uk)
Tue, 20 Jul 1999 00:40:00 +0100


Hi,

On Tue, Jun 08, 1999 at 04:55:05PM -0700, David S. Miller wrote:

[dir.c]

> +static kmem_cache_t *nfs_fh_cachep;
[..]
> +int nfs_init_fhcache(void)
> +{
> + nfs_fh_cachep = kmem_cache_create("nfs_fh",
> + sizeof(struct nfs_fh),
> + 0, SLAB_HWCACHE_ALIGN,
> + NULL, NULL);
> + if (nfs_fh_cachep == NULL)
> + return -ENOMEM;
> +
> + nfs_cookie_cachep = kmem_cache_create("nfs_dcookie",
> + sizeof(struct nfs_cookie_table),
> + 0, SLAB_HWCACHE_ALIGN,
> + NULL, NULL);
> + if (nfs_cookie_cachep == NULL)
> + return -ENOMEM;
> +
> + return 0;
> }

Errrrm.. A couple of thoughts (which I haven't been able to test ATM, 'cos
nfs.o doesn't load) about this:

1) If you rmmod nfs, and then cat /proc/slabinfo, it'll segfault 'cos the name
won't be in memory any more.

2) if you re-insert nfs.o having rmmod'd it, the kmem_cache_create calls will
fail, as the cache already exists.

Am I right?

The comments at the top of mm/slab.c say something about putting module's
cachep's in memory which is not unloaded. I don't know if this is possible
(perhaps by putting it in a different section of some sort).

The easier solution seems to be to add a function to slab.c to search for
a named cache and return a pointer to it (and kmem_cache_shrink() the cache
when the module is unloaded).

-- 
I do not find in orthodox Christianity one redeeming feature.
	 - Thomas Jefferson

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