Re: [PATCH] slab: introduce kmem_cache_zalloc allocator

From: Pekka J Enberg
Date: Tue Mar 21 2006 - 02:11:18 EST


On Mon, 20 Mar 2006, Balbir Singh wrote:
> When I allocate the structure - I would like to do
>
> kmem_cache_alloc_set(&resp, GFP_XXXXX, 0xEE)
>
> The device should ideally fill all fields of resp. Fields that look
> 0xEE after receiving the response -- would indicate that they were not
> filled by the device. This would be extremely useful in debugging.
> With kmem_cache_zalloc() - 0 is usually almost always a valid value.
> It is useful in some cases and no so much in other cases.
>
> I could easily achieve the same thing by doing a
>
> memset(&resp, 0xEE, size)
>
> after the kmem_cache_alloc(). But since there is an API to zero out
> allocated memory, I thought we could make it more generic and more
> useful.

Yeah, but if it's a debugging thing, I don't see much point in adding yet
another API call. The main point in introducing kmem_cache_zalloc() is to
move existing API into slab proper.

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