[RFC 0/2] guarantee natural alignment for kmalloc()

From: Vlastimil Babka
Date: Tue Mar 19 2019 - 17:11:31 EST


The recent thread [1] inspired me to look into guaranteeing alignment for
kmalloc() for power-of-two sizes. Turns out it's not difficult and in most
configuration nothing really changes as it happens implicitly. More details in
the first patch. If we agree we want to do this, I will see where to update
documentation and perhaps if there are any workarounds in the tree that can be
converted to plain kmalloc() afterwards.

The second patch is quick and dirty selftest for the alignment. Suggestions
welcome whether and how to include this kind of selftest that has to be
in-kernel.

[1] https://lore.kernel.org/linux-fsdevel/20190225040904.5557-1-ming.lei@xxxxxxxxxx/T/#u

Vlastimil Babka (2):
mm, sl[aou]b: guarantee natural alignment for kmalloc(power-of-two)
mm, sl[aou]b: test whether kmalloc() alignment works as expected

mm/slab_common.c | 30 +++++++++++++++++++++++++++++-
mm/slob.c | 42 +++++++++++++++++++++++++++++++-----------
2 files changed, 60 insertions(+), 12 deletions(-)

--
2.21.0