From: Nathan Chancellor Date: Thu, 14 Aug 2025 20:05:22 +0000 (-0700) Subject: mm/rmap: always inline __folio_rmap_sanity_checks() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c5ecf2244d66140a710f79fe2ea6c70d373b0b60;p=users%2Fjedix%2Flinux-maple.git mm/rmap: always inline __folio_rmap_sanity_checks() Commit 5e901e249ad1 ("mm/rmap: convert "enum rmap_level" to "enum pgtable_level"") changed VM_WARN_ON_ONCE, a run time warning, into BUILD_BUG, a compile time error. After this adjustment, certain builds with older versions of clang (such as arm64 allmodconfig) started failing to build with: In file included from mm/rmap.c:63: In file included from include/linux/ksm.h:14: include/linux/rmap.h:440:3: error: call to __compiletime_assert_890 declared with 'error' attribute: BUILD_BUG failed BUILD_BUG(); ^ ... :21:1: note: expanded from here __compiletime_assert_890 ^ While __folio_rmap_sanity_checks() is marked 'inline', the compiler may not always honor it, such as when sanitizers or other instrumentation is enabled. If __folio_rmap_sanity_checks() is not inlined, there is no way the compiler can eliminate the default cause. Mark __folio_rmap_sanity_checks() as __always_inline to allow the BUILD_BUG() to work consistently, which clears up the error. Link: https://lkml.kernel.org/r/20250814-rmap-fix-build_bug-conversion-v1-1-fb7b10a0b362@kernel.org Signed-off-by: Nathan Chancellor Reviewed-by: Lorenzo Stoakes Acked-by: David Hildenbrand Signed-off-by: Andrew Morton --- diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 9d40d127bdb7..e8aff6d2deda 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -394,7 +394,7 @@ typedef int __bitwise rmap_t; /* The anonymous (sub)page is exclusive to a single process. */ #define RMAP_EXCLUSIVE ((__force rmap_t)BIT(0)) -static inline void __folio_rmap_sanity_checks(const struct folio *folio, +static __always_inline void __folio_rmap_sanity_checks(const struct folio *folio, const struct page *page, int nr_pages, enum pgtable_level level) { /* hugetlb folios are handled separately. */