Re: No kmem_cache_destroy?

Johannes Erdfelt (jerdfelt@sventech.com)
Fri, 6 Aug 1999 00:50:34 -0400


On Thu, Aug 05, 1999, David S. Miller <davem@redhat.com> wrote:
> Date: Fri, 6 Aug 1999 00:21:40 -0400
> From: Johannes Erdfelt <jerdfelt@sventech.com>
>
> I'd like to use a kmem_cache in the UHCI module, however I don't
> see a good way of doing this. The comments in mm/slab.c are a
> little confusing:
>
> I've been meaning to fix this, the way to really do it is:
>
> 1) Never require that a slab gets destroyed. Even after the
> module unloads, the cache will be shrunk naturally as the
> system trims SLAB caches all the time when memory gets tight.
>
> 2) Have kmem_cache_create copy the string over into a new buffer,
> so the reference to the string in the module doesn't exist.
> In fact make kmem_cache_t->name[64] or whatever so that it
> will still work while SLAB is setting itself up.
>
> 3) Have kmem_cache_create check to see if the slab exists already,
> by comparing the name and the parameters. If they match, just
> return the old slab cache pointer, don't make a new one.
>
> This will solve all the problems in one go, and localize the changes
> to one spot.

Looking now, this doesn't look all too difficult to do. Would you accept
a patch which does this? If so, I'll work on it.

JE

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