Re: [patch] real fix [Re: [patch] fixed 2.2.1 inode-leakage due bogus design of the free_inodes algo

Vijay G Bharadwaj (vgb@cshcn.umd.edu)
Thu, 11 Feb 1999 13:04:11 -0500 (EST)


On Thu, 11 Feb 1999, Matti Aarnio wrote:

> Yes and No. kmem_cache_create() FAILS if the named cache
> exists. However there is no kmem_cache_delete() which would
> used to remove some module related cache... (IP*/TCP comes
> to my mind as an example needing it.)

I did this long back, and came up with an IMHO cleaner solution... I just
added a function kmem_cache_find() to mm/slab.c and exported it through
ksyms.c. kmem_cache_find() just returns a pointer to an existing slab
cache. The code for it already exists in kmem_cache_create() (that's how
kmem_cache_create() checks if the cache already exists).

So all my module had to do was call kmem_cache_find() and if it returned
non-NULL then use the existing cache, else create a new one.

Of course this assumes you can patch the kernel...

This was a long time ago - and I agree slab.c needs a cleanup, but I know
precious little about MM. I thought I was the only person using slabs from
modules...

-Vijay

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