Skip to content

Commit 7e89979

Browse files
committed
include/linux/pgtable.h: convert arch_enter_lazy_mmu_mode() and friends to static inlines
commit c519c3c ("mm/kasan: avoid lazy MMU mode hazards") introduced the use of arch_enter_lazy_mmu_mode(), which results in the compiler complaining about "statement has no effect", when __HAVE_ARCH_LAZY_MMU_MODE is not defined in include/linux/pgtable.h The exact warning/error is: In file included from ./include/linux/kasan.h:37, from mm/kasan/shadow.c:14: mm/kasan/shadow.c: In function kasan_populate_vmalloc_pte: ./include/linux/pgtable.h:247:41: error: statement with no effect [-Werror=unused-value] 247 | #define arch_enter_lazy_mmu_mode() (LAZY_MMU_DEFAULT) | ^ mm/kasan/shadow.c:322:9: note: in expansion of macro arch_enter_lazy_mmu_mode> 322 | arch_enter_lazy_mmu_mode(); | ^~~~~~~~~~~~~~~~~~~~~~~~ switching these "functions" to static inlines fixes this up. Fixes: c519c3c ("mm/kasan: avoid lazy MMU mode hazards") Reported-by: Balbir Singh <balbirs@nvidia.com> Closes: https://lkml.kernel.org/r/20250912235515.367061-1-balbirs@nvidia.com Cc: Alexander Gordeev <agordeev@linux.ibm.com> Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 06195ee commit 7e89979

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/linux/pgtable.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,9 @@ static inline int pmd_dirty(pmd_t pmd)
232232
* and the mode cannot be used in interrupt context.
233233
*/
234234
#ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE
235-
#define arch_enter_lazy_mmu_mode() do {} while (0)
236-
#define arch_leave_lazy_mmu_mode() do {} while (0)
237-
#define arch_flush_lazy_mmu_mode() do {} while (0)
235+
static inline void arch_enter_lazy_mmu_mode(void) {}
236+
static inline void arch_leave_lazy_mmu_mode(void) {}
237+
static inline void arch_flush_lazy_mmu_mode(void) {}
238238
#endif
239239

240240
#ifndef pte_batch_hint

0 commit comments

Comments
 (0)