linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: lsf-pc@lists.linux-foundation.org
Cc: Linux-FSDevel <linux-fsdevel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	linux-block@vger.kernel.org, Michal Hocko <mhocko@kernel.org>,
	Christoph Lameter <cl@linux.com>,
	David Rientjes <rientjes@google.com>,
	Pekka Enberg <penberg@kernel.org>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Ming Lei <ming.lei@redhat.com>,
	linux-xfs@vger.kernel.org, Christoph Hellwig <hch@infradead.org>,
	Dave Chinner <david@fromorbit.com>,
	"Darrick J . Wong" <darrick.wong@oracle.com>
Subject: [LSF/MM TOPIC] guarantee natural alignment for kmalloc()?
Date: Thu, 11 Apr 2019 14:52:08 +0200	[thread overview]
Message-ID: <790b68b7-3689-0ff6-08ae-936728bc6458@suse.cz> (raw)

Hi,

here's a late topic for discussion that came out of my patchset [1]. It
would likely have to involve all three groups, as FS/IO people would
benefit, but it's MM area.

Background:
The recent thread [2] inspired me to look into guaranteeing alignment
for kmalloc() for power-of-two sizes. IIUC some usecases (see [2]) don't
know the required sizes in advance in order to create named caches via
kmem_cache_create() with explicit alignment parameter (which is the only
way to guarantee alignment right now). Moreover, in most cases the
alignment happens naturally as the slab allocators split
power-of-two-sized pages into smaller power-of-two-sized objects.
kmalloc() users then might rely on the alignment even unknowingly, until
it breaks when e.g. SLUB debugging is enabled.

Turns out it's not difficult to add the guarantees [1] and in the
production SLAB/SLUB configurations nothing really changes as explained
above. Then folks wouldn't have to come up with workarounds as in [2].
Technical downsides would be for SLUB debug mode (increased memory
fragmentation, should be acceptable in a bug hunting scenario?), and
SLOB (potentially worse performance due to increased packing effort, but
this slab variant is rather marginal).

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).

Thanks,
Vlastimil

[1] https://lore.kernel.org/lkml/20190319211108.15495-1-vbabka@suse.cz/T/#u
[2]
https://lore.kernel.org/linux-fsdevel/20190225040904.5557-1-ming.lei@redhat.com/T/#u

             reply	other threads:[~2019-04-11 12:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11 12:52 Vlastimil Babka [this message]
2019-04-11 13:28 ` [LSF/MM TOPIC] guarantee natural alignment for kmalloc()? 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
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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=790b68b7-3689-0ff6-08ae-936728bc6458@suse.cz \
    --to=vbabka@suse.cz \
    --cc=cl@linux.com \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=lsf-pc@lists.linux-foundation.org \
    --cc=mhocko@kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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).