[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1503251935180.16714@chino.kir.corp.google.com>
Date: Wed, 25 Mar 2015 19:37:40 -0700 (PDT)
From: David Rientjes <rientjes@...gle.com>
To: Mikulas Patocka <mpatocka@...hat.com>
cc: Andrew Morton <akpm@...ux-foundation.org>,
Dave Kleikamp <shaggy@...nel.org>,
Christoph Hellwig <hch@....de>,
Sebastian Ott <sebott@...ux.vnet.ibm.com>,
Catalin Marinas <catalin.marinas@....com>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
jfs-discussion@...ts.sourceforge.net
Subject: Re: [patch 1/4] fs, jfs: remove slab object constructor
On Wed, 25 Mar 2015, Mikulas Patocka wrote:
> > Mempools based on slab caches with object constructors are risky because
> > element allocation can happen either from the slab cache itself, meaning
> > the constructor is properly called before returning, or from the mempool
> > reserve pool, meaning the constructor is not called before returning,
> > depending on the allocation context.
>
> I don't think there is any problem. If the allocation is hapenning from
> the slab cache, the constructor is called from the slab sybsystem.
>
> If the allocation is hapenning from the mempool reserve, the constructor
> was called in the past (when the mempool reserve was refilled from the
> cache). So, in both cases, the object allocated frmo the mempool is
> constructed.
>
That would be true only for
ptr = mempool_alloc(gfp, pool);
mempool_free(ptr, pool);
and nothing in between, and that's pretty pointless. Typically, callers
allocate memory, modify it, and then free it. When that happens with
mempools, and we can't allocate slab because of the gfp context, mempools
will return elements in the state in which they were freed (modified, not
as constructed).
--
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