On Tue, 21 Mar 2006, Andrew Morton wrote:I agree - memset just before use is the Right Thing (tm).
I've always felt that this was an odd design. Because
a) All that cache-warmth which we get from the constructor's zeroing can
be lost by the time we get around to using an individual object and
b) The object may be cache-cold by the time we free it, and we'll take
cache misses just putting it back into a constructed state for
kmem_cache_free(). And we'll lose that cache warmth by the time we use
this object again.
So from that POV I think (in my simple way) that this is a good patch. But
IIRC, Manfred has reasons why it might not be?
I assume the design comes from Bonwick's paper which states that the purpose of object constructor is to support one-time initialization of objects which we're _not_ doing in this case.