archive mirror
 help / color / mirror / Atom feed
From: Christopher Lameter <>
To: Vlastimil Babka <>
Cc: James Bottomley <>,,
	Linux-FSDevel <>,
	linux-mm <>,, Michal Hocko <>,
	David Rientjes <>,
	Pekka Enberg <>,
	Joonsoo Kim <>,
	Ming Lei <>,, Christoph Hellwig <>,
	Dave Chinner <>,
	"Darrick J . Wong" <>
Subject: Re: [LSF/MM TOPIC] guarantee natural alignment for kmalloc()?
Date: Tue, 16 Apr 2019 15:38:54 +0000	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Fri, 12 Apr 2019, Vlastimil Babka wrote:

> On 4/12/19 9:14 AM, James Bottomley wrote:
> >> In the session I hope to resolve the question whether this is indeed
> >> the right thing to do for all kmalloc() users, without an explicit
> >> alignment requests, and if it's worth the potentially worse
> >> performance/fragmentation it would impose on a hypothetical new slab
> >> implementation for which it wouldn't be optimal to split power-of-two
> >> sized pages into power-of-two-sized objects (or whether there are any
> >> other downsides).
> >
> > I think so.  The question is how aligned?  explicit flushing arch's
> > definitely need at least cache line alignment when using kmalloc for
> > I/O and if allocations cross cache lines they have serious coherency
> > problems.   The question of how much more aligned than this is
> > interesting ... I've got to say that the power of two allocator implies
> > same alignment as size and we seem to keep growing use cases that
> > assume this.

Well that can be controlled on a  per arch level through KMALLOC_MIN_ALIGN
already. There are architectues that align to cache line boundaries.
However you sometimes have hardware with ridiculous large cache line
length configurations like VSMP with 4k.

> Right, by "natural alignment" I meant exactly that - align to size for
> power-of-two sizes.

Well for which sizes? Double word till PAGE_SIZE? This gets us into weird
and difficult to comprehend rules for how objects are aligned. Or do we
start on the cache line size to provide cacheline alignment and do word
alignment before?

Consistency is important I think and if you want something different then
you need to say so in one way or another.

> > I'm not so keen on growing a separate API unless there's
> > a really useful mm efficiency in breaking the kmalloc alignment
> > assumptions.
> I'd argue there's not.

  reply	other threads:[~2019-04-16 15:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11 12:52 [LSF/MM TOPIC] guarantee natural alignment for kmalloc()? Vlastimil Babka
2019-04-11 13:28 ` Matthew Wilcox
2019-04-25 11:33   ` Matthew Wilcox
2019-04-25 12:03     ` Martin K. Petersen
2019-04-25 12:03     ` Michal Hocko
2019-04-12  7:14 ` James Bottomley
2019-04-12  7:54   ` Vlastimil Babka
2019-04-16 15:38     ` Christopher Lameter [this message]
2019-04-17  8:07       ` Vlastimil Babka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).