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>, stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sasha Levin <sashal@kernel.org>, Li Zhe <lizhe.67@bytedance.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org
Subject: Re: [PATCH 6.1.y] mm/mmu_notifier: convert !CONFIG_MMU_NOTIFIER range_init stubs to inline
Date: Fri, 4 Dec 2026 14:21:32 +0100	[thread overview]
Message-ID: <77806d54-d9ff-49bf-a3a9-70ade6687d2b@kernel.org> (raw)
In-Reply-To: <20261204131908.1140787-1-alexander.sverdlin@siemens.com>

On 12/4/26 14:19, A. Sverdlin wrote:
> From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> 
> This is a stable-only fix for a 6.1.y build failure, mainline is not
> affected.
> 
> When backporting upstream commit 92daa8652f88 ("mm/hugetlb: fix mremap
> deadlock when PMD sharing is possible") to 6.1.y as 02e932981359, the
> MMU notifier calls were moved into the __unmap_hugepage_range() wrapper.
> The wrapper's local 'mm' is only passed to mmu_notifier_range_init(),
> which without CONFIG_MMU_NOTIFIER is a macro discarding all arguments
> except range, start and end. This breaks -Werror builds:
> 
>   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;
>                            ^~
> 
> Turn the !CONFIG_MMU_NOTIFIER mmu_notifier_range_init() and
> mmu_notifier_range_init_owner() 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.
> 
> Fixes: 02e932981359 ("mm/hugetlb: fix mremap deadlock when PMD sharing is possible")
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> ---
> 
> Upstream 92daa8652f88 has no such variable, so there is nothing to
> backport; the same conversion has been proposed for mainline as a
> cleanup [1]. As mainline builds are not affected, it will carry neither
> Fixes: nor Cc: stable there [2], and it would not apply to 6.1.y anyway,
> because 6.1.y still has the vma argument removed upstream by commit
> 7d4a8be0c4b2 ("mm/mmu_notifier: remove unused
> mmu_notifier_range_update_to_read_only export").
> 
> Build-tested on top of v6.1.193 with x86_64 defconfig,
> CONFIG_MMU_NOTIFIER=n and -Werror, compiling all callers of
> mmu_notifier_range_init{,_owner}(); the disassembly of these objects is
> identical to v6.1.193. Build-tested for aarch64 as well.
> 
> [1] https://lore.kernel.org/all/20261203154538.1660381-1-alexander.sverdlin@siemens.com/
> [2] https://lore.kernel.org/all/e088d36a-c052-4c8b-8070-8e7d938c3e79@kernel.org/
> 
>  include/linux/mmu_notifier.h | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
> index e4ca5dd63bdd0..5e939b293b359 100644
> --- a/include/linux/mmu_notifier.h
> +++ b/include/linux/mmu_notifier.h
> @@ -667,11 +667,21 @@ static inline void _mmu_notifier_range_init(struct mmu_notifier_range *range,
>  	range->end = end;
>  }
>  
> -#define mmu_notifier_range_init(range,event,flags,vma,mm,start,end)  \
> -	_mmu_notifier_range_init(range, start, end)
> -#define mmu_notifier_range_init_owner(range, event, flags, vma, 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 vm_area_struct *vma, 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 vm_area_struct *vma, 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)

Acked-by: David Hildenbrand (Arm) <david@kernel.org>

-- 
Cheers,

David


  reply	other threads:[~2026-12-04 13:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 13:19 [PATCH 6.1.y] mm/mmu_notifier: convert !CONFIG_MMU_NOTIFIER range_init stubs to inline A. Sverdlin
2026-12-04 13:21 ` David Hildenbrand (Arm) [this message]
2026-12-04 19:49 ` Sasha Levin

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=77806d54-d9ff-49bf-a3a9-70ade6687d2b@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.sverdlin@siemens.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-mm@kvack.org \
    --cc=lizhe.67@bytedance.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.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