[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190930133203.GA26804@bombadil.infradead.org>
Date: Mon, 30 Sep 2019 06:32:03 -0700
From: Matthew Wilcox <willy@...radead.org>
To: Christopher Lameter <cl@...ux.com>
Cc: Vlastimil Babka <vbabka@...e.cz>,
Andrew Morton <akpm@...ux-foundation.org>,
David Sterba <dsterba@...e.cz>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Ming Lei <ming.lei@...hat.com>,
Dave Chinner <david@...morbit.com>,
"Darrick J . Wong" <darrick.wong@...cle.com>,
Christoph Hellwig <hch@....de>, linux-xfs@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-block@...r.kernel.org,
James Bottomley <James.Bottomley@...senpartnership.com>,
linux-btrfs@...r.kernel.org, Roman Gushchin <guro@...com>,
Johannes Weiner <hannes@...xchg.org>
Subject: Re: [PATCH v2 2/2] mm, sl[aou]b: guarantee natural alignment for
kmalloc(power-of-two)
On Sat, Sep 28, 2019 at 01:12:49AM +0000, Christopher Lameter wrote:
> However, the layout may be different due to another allocator that prefers
> to arrange things differently (SLOB puts multiple objects of different
> types in the same page to save memory), if we need to add data to these
> objects (debugging info, new metadata about the object, maybe the memcg
> pointer, maybe other things that may come up), or other innovative
> approaches (such as putting data of different kmem caches that are
> commonly used together in the same page to improve locality).
If we ever do start putting objects of different sizes that are commonly
allocated together in the same page (eg inodes & dentries), then those
aren't going to be random kmalloc() allocation; they're going to be
special kmem caches that can specify "I don't care about alignment".
Also, we haven't done that. We've had a slab allocator for twenty years,
and nobody's tried to do that. Maybe the co-allocation would be a net
loss (I suspect). Or the gain is too small for the added complexity.
Whatever way, this is a strawman.
> The cost is an unnecessary petrification of the data layout of the memory
> allocators.
Yes, it is. And it's a cost I'm willing to pay in order to get the
guarantee of alignment.
Powered by blists - more mailing lists