Re: [PATCH 1/2] slab: __GFP_ZERO is incompatible with a constructor

From: Christopher Lameter
Date: Tue Apr 10 2018 - 16:21:52 EST


On Tue, 10 Apr 2018, Matthew Wilcox wrote:

> > Objects can be freed and reused and still be accessed from code that
> > thinks the object is the old and not the new object....
>
> Yes, I know, that's the point of RCU typesafety. My point is that an
> object *which has never been used* can't be accessed. So you don't *need*
> a constructor.

But the object needs to have the proper contents after it was released and
re-allocated. Some objects may rely on contents (like list heads)
surviving the realloc process because access must always be possible.

validate_slab() checks on proper metadata content in a slab
although it does not access the payload. So that may work you separate
the payload init from the metadata init.