Re: [RFC] kmem_cache_zalloc

From: Christoph Hellwig (hch@infradead.org)
Date: Wed Mar 27 2002 - 15:19:17 EST


On Wed, Mar 27, 2002 at 01:39:17PM -0600, Eric Sandeen wrote:
> In the interest of whittling down the changes that XFS makes to the core
> kernel, I thought I'd start throwing out some the easier self-contained
> modifications for discussion.
>
> XFS adds a kmem_cache_zalloc function to mm/slab.c, it does what you
> might expect: kmem_cache_alloc + memset

I'd really go for k(mem_)zalloc, but a kmem_cache_alloc leads people toward
writing bad code. The purpose of the slab allocator is to allow caching
readily constructed objects, a _zalloc destroys them on alloc.

I think code using kmem_cache_alloc really wants to use kzalloc and instead
of maintaining it's pool.

        Christoph

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



This archive was generated by hypermail 2b29 : Sun Mar 31 2002 - 22:00:13 EST