Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm: page-flags-layout.h: change the KASAN_TAG_WIDTH for HW_TAGS

KASAN_TAG_WIDTH is 8 bits for both (HW_TAGS and SW_TAGS), but for HW_TAGS
the KASAN_TAG_WIDTH can be 4 bits bits because due to the design of the
MTE the memory words for storing metadata only need 4 bits. Change the
preprocessor define KASAN_TAG_WIDTH for check if SW_TAGS is define, so
KASAN_TAG_WIDTH should be 8 bits, but if HW_TAGS is define, so
KASAN_TAG_WIDTH should be 4 bits to save a few flags bits.

Link: https://lkml.kernel.org/r/20250428201409.5482-1-trintaeoitogc@gmail.com
Signed-off-by: Guilherme Giacomo Simoes <trintaeoitogc@gmail.com>
Suggested-by: Andrey Konovalov <andreyknvl@gmail.com>
Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Guilherme Giacomo Simoes and committed by
Andrew Morton
69eadd6a 3e43e260

+3 -1
+3 -1
include/linux/page-flags-layout.h
··· 72 72 #define NODE_NOT_IN_PAGE_FLAGS 1 73 73 #endif 74 74 75 - #if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS) 75 + #if defined(CONFIG_KASAN_SW_TAGS) 76 76 #define KASAN_TAG_WIDTH 8 77 + #elif defined(CONFIG_KASAN_HW_TAGS) 78 + #define KASAN_TAG_WIDTH 4 77 79 #else 78 80 #define KASAN_TAG_WIDTH 0 79 81 #endif