[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0712172343370.22511@sbz-30.cs.Helsinki.FI>
Date: Mon, 17 Dec 2007 23:55:17 +0200 (EET)
From: Pekka J Enberg <penberg@...helsinki.fi>
To: John Reiser <jreiser@...Wagon.com>
cc: linux-kernel@...r.kernel.org
Subject: Re: slab quirks in DEBUG, ctor, and initialization
Hi John,
On Mon, 17 Dec 2007, John Reiser wrote:
> idr_pre_get calls kmem_cache_alloc, which constructs 'struct idr_layer'
> via the cachep->ctor() call from cache_alloc_debugcheck_after to
> idr_cache_ctor, and not via cache_init_objs. So if DEBUG is off,
> then idr_cache_ctor does not get its chance to call memset,
> which could leave the struct idr_layer potentially undefined.
No, init_cache_objs() will call the constructor, if the cache has one when
DEBUG is not set so the struct idr_layer can never be undefined. However,
struct idr_layer can contain non-zero elements if someone does a
kmem_cache_free() on an object that hasn't been zeroed. If that matters
here, idr_pre_get should call kmem_cache_zalloc() and drop the
constructor.
Pekka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists