Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: "A. Sverdlin" <alexander.sverdlin@siemens.com>, linux-mm@kvack.org
Cc: "Liam R. Howlett" <liam@infradead.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	Mike Rapoport <rppt@kernel.org>, Michal Hocko <mhocko@suse.com>
Subject: Re: [PATCH v2] mm/mmu_notifier: convert !CONFIG_MMU_NOTIFIER range_init stubs to inline
Date: Thu, 3 Dec 2026 18:19:29 +0100	[thread overview]
Message-ID: <ea72ff1f-91f0-4e4f-9cd9-b893ce0fa516@kernel.org> (raw)
In-Reply-To: <20261203154538.1660381-1-alexander.sverdlin@siemens.com>

On 12/3/26 16:45, A. Sverdlin wrote:
> From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> 
> 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.

Let's remove most of the 6.1.y details below and instead say something generic like

"This already caused problems in stable kernels (e.g., 6.1.y [1]), so let's just
prevent more problems like that by avoiding marcros here."

[1] https://link.to...

Thoughts?

> 
> 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.
> 
> 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.
> 
> 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;
>                          ^~
> 
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> ---
> 
> 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.
> 
> Changelog:
> v2:
> - extended commit message, dropped Cc: stable
> - re-formatted functions' headers
> v1:
> - https://lore.kernel.org/all/20261202121602.3159289-1-alexander.sverdlin@siemens.com/
> 
>  include/linux/mmu_notifier.h | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
> index 5db78e5761c5c..191cfa95375ce 100644
> --- a/include/linux/mmu_notifier.h
> +++ b/include/linux/mmu_notifier.h
> @@ -570,11 +570,20 @@ 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)


-- 
Cheers,

David


      reply	other threads:[~2026-12-03 17:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 15:45 [PATCH v2] mm/mmu_notifier: convert !CONFIG_MMU_NOTIFIER range_init stubs to inline A. Sverdlin
2026-12-03 17:19 ` David Hildenbrand (Arm) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea72ff1f-91f0-4e4f-9cd9-b893ce0fa516@kernel.org \
    --to=david@kernel.org \
    --cc=alexander.sverdlin@siemens.com \
    --cc=liam@infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=vbabka@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox