From: Alexander Sverdlin Without CONFIG_MMU_NOTIFIER, mmu_notifier_range_init() and mmu_notifier_range_init_owner() are macros which discard all arguments except range, start and end. A local variable which is only passed to them is therefore reported as unused, but only in !CONFIG_MMU_NOTIFIER builds. Callers must not care whether these are macros. Turn them into static inline functions with the same prototypes as in the CONFIG_MMU_NOTIFIER=y case, so that all arguments are consumed and type-checked. No change in generated code. Cc: stable@vger.kernel.org # 6.1.x Signed-off-by: Alexander Sverdlin --- On 6.1.y, the backport of commit 92daa8652f88 ("mm/hugetlb: fix mremap deadlock when PMD sharing is possible") left such a variable in __unmap_hugepage_range(), breaking -Werror builds. Mainline and newer stable trees are not affected. Build failure on v6.1.193 with CONFIG_MMU_NOTIFIER=n: mm/hugetlb.c: In function '__unmap_hugepage_range': mm/hugetlb.c:5509:27: error: unused variable 'mm' [-Werror=unused-variable] struct mm_struct *mm = vma->vm_mm; ^~ 6.1.y still has the vma argument removed by commit 7d4a8be0c4b2 ("mm/mmu_notifier: remove unused mmu_notifier_range_update_to_read_only export"), so this will need an adapted backport. include/linux/mmu_notifier.h | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h index 5db78e5761c5c..e5c57af2bc181 100644 --- a/include/linux/mmu_notifier.h +++ b/include/linux/mmu_notifier.h @@ -570,11 +570,24 @@ static inline void _mmu_notifier_range_init(struct mmu_notifier_range *range, range->end = end; } -#define mmu_notifier_range_init(range,event,flags,mm,start,end) \ - _mmu_notifier_range_init(range, start, end) -#define mmu_notifier_range_init_owner(range, event, flags, mm, start, \ - end, owner) \ - _mmu_notifier_range_init(range, start, end) +static inline void mmu_notifier_range_init(struct mmu_notifier_range *range, + enum mmu_notifier_event event, + unsigned int flags, + struct mm_struct *mm, + unsigned long start, + unsigned long end) +{ + _mmu_notifier_range_init(range, start, end); +} + +static inline void +mmu_notifier_range_init_owner(struct mmu_notifier_range *range, + enum mmu_notifier_event event, unsigned int flags, + struct mm_struct *mm, unsigned long start, + unsigned long end, void *owner) +{ + _mmu_notifier_range_init(range, start, end); +} static inline bool mmu_notifier_range_blockable(const struct mmu_notifier_range *range) -- 2.56.1