]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm: page-flags-layout.h: change the KASAN_TAG_WIDTH for HW_TAGS
authorGuilherme Giacomo Simoes <trintaeoitogc@gmail.com>
Mon, 28 Apr 2025 20:14:09 +0000 (17:14 -0300)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 13 May 2025 06:50:49 +0000 (23:50 -0700)
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>
include/linux/page-flags-layout.h

index 4f5c9e979bb9aace9b8f2f24af2a99836c73f680..760006b1c48085585616a6fa4c42ed6cbb1e5573 100644 (file)
 #define NODE_NOT_IN_PAGE_FLAGS 1
 #endif
 
-#if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS)
+#if defined(CONFIG_KASAN_SW_TAGS)
 #define KASAN_TAG_WIDTH 8
+#elif defined(CONFIG_KASAN_HW_TAGS)
+#define KASAN_TAG_WIDTH 4
 #else
 #define KASAN_TAG_WIDTH 0
 #endif