Re: [PATCH v3] mm: make minimum slab alignment a runtime property

From: David Rientjes
Date: Sun Apr 24 2022 - 15:15:32 EST

On Fri, 22 Apr 2022, Peter Collingbourne wrote:

> When CONFIG_KASAN_HW_TAGS is enabled we currently increase the minimum
> slab alignment to 16. This happens even if MTE is not supported in
> hardware or disabled via kasan=off, which creates an unnecessary
> memory overhead in those cases. Eliminate this overhead by making
> the minimum slab alignment a runtime property and only aligning to
> 16 if KASAN is enabled at runtime.
> On a DragonBoard 845c (non-MTE hardware) with a kernel built with
> CONFIG_KASAN_HW_TAGS, waiting for quiescence after a full Android
> boot I see the following Slab measurements in /proc/meminfo (median
> of 3 reboots):
> Before: 169020 kB
> After: 167304 kB
> Link:
> Signed-off-by: Peter Collingbourne <pcc@xxxxxxxxxx>
> Reviewed-by: Andrey Konovalov <andreyknvl@xxxxxxxxx>

Acked-by: David Rientjes <rientjes@xxxxxxxxxx>

The command line options are described by
Documentation/dev-tools/kasan.rst but it doesn't look like a update is
necessary. I think the assumption today is that if we're using kasan=off
then we aren't doing the alignment.

I do wonder why kasan=off is not at least mentioned in
Documentation/admin-guide/kernel-parameters.txt and perhaps for all other
kasan options point the reader to Documentation/dev-tools/kasan.rst.