Re: [PATCH] kmem_cache_zalloc()

Brian Gerst (bgerst@didntduck.org)
Wed, 03 Apr 2002 17:42:28 -0500


Tommy Reynolds wrote:
>
> Uttered "Eric Sandeen" <sandeen@sgi.com>, spoke thus:
>
> > In short, we're using a kmem_cache_zalloc() function in XFS which just
> > does kmem_cache_alloc + memset.
> >
> > We'd like to incorporate this into the kernel proper, and several others
> > chimed in that it would be useful, so here's the patch. If it's a no-go
> > with you, we can roll this functionality back under fs/xfs to reduce our
> > changes in the mainline kernel.
>
> Why not use the constructor function interface to kmem_cache_create that is
> _already_ in the kernel API?

Constructors are only called once when the slab is allocated. It is
expected that objects are returned to the slab in the same state.

I think a better idea would be to add a flag to the cache that tells
kmem_cache_alloc() to zero out the object it allocates instead of
creating another interface.

--

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