linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@redhat.com>,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH] mm: kill mm_wr_locked from unmap_vmas() and unmap_single_vma()
Date: Thu, 6 Nov 2025 11:34:52 -0500	[thread overview]
Message-ID: <xuyrhqdyceyhcdwecgb5zghgyolorewskx5yxxeqjhs2cpeziu@s7llff42vxai> (raw)
In-Reply-To: <20251104085709.2688433-1-wangkefeng.wang@huawei.com>

* Kefeng Wang <wangkefeng.wang@huawei.com> [251104 03:57]:
> Kill mm_wr_locked since commit f8e97613fed2 ("mm: convert VM_PFNMAP
> tracking to pfnmap_track() + pfnmap_untrack()") remove the user.

Thanks.

Many of these functions have way too many variables passed through, and
we weren't even using this one.

Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>


> 
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  include/linux/mm.h               |  2 +-
>  mm/memory.c                      | 12 ++++--------
>  mm/mmap.c                        |  2 +-
>  mm/vma.c                         |  5 ++---
>  tools/testing/vma/vma_internal.h |  3 +--
>  5 files changed, 9 insertions(+), 15 deletions(-)
> 
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index f27c3687ea43..9909e35ebb8d 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -2471,7 +2471,7 @@ static inline void zap_vma_pages(struct vm_area_struct *vma)
>  }
>  void unmap_vmas(struct mmu_gather *tlb, struct ma_state *mas,
>  		struct vm_area_struct *start_vma, unsigned long start,
> -		unsigned long end, unsigned long tree_end, bool mm_wr_locked);
> +		unsigned long end, unsigned long tree_end);
>  
>  struct mmu_notifier_range;
>  
> diff --git a/mm/memory.c b/mm/memory.c
> index 4c3a7e09a159..1a1626bba55a 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -2023,8 +2023,7 @@ void unmap_page_range(struct mmu_gather *tlb,
>  
>  static void unmap_single_vma(struct mmu_gather *tlb,
>  		struct vm_area_struct *vma, unsigned long start_addr,
> -		unsigned long end_addr,
> -		struct zap_details *details, bool mm_wr_locked)
> +		unsigned long end_addr, struct zap_details *details)
>  {
>  	unsigned long start = max(vma->vm_start, start_addr);
>  	unsigned long end;
> @@ -2070,7 +2069,6 @@ static void unmap_single_vma(struct mmu_gather *tlb,
>   * @start_addr: virtual address at which to start unmapping
>   * @end_addr: virtual address at which to end unmapping
>   * @tree_end: The maximum index to check
> - * @mm_wr_locked: lock flag
>   *
>   * Unmap all pages in the vma list.
>   *
> @@ -2085,8 +2083,7 @@ static void unmap_single_vma(struct mmu_gather *tlb,
>   */
>  void unmap_vmas(struct mmu_gather *tlb, struct ma_state *mas,
>  		struct vm_area_struct *vma, unsigned long start_addr,
> -		unsigned long end_addr, unsigned long tree_end,
> -		bool mm_wr_locked)
> +		unsigned long end_addr, unsigned long tree_end)
>  {
>  	struct mmu_notifier_range range;
>  	struct zap_details details = {
> @@ -2102,8 +2099,7 @@ void unmap_vmas(struct mmu_gather *tlb, struct ma_state *mas,
>  		unsigned long start = start_addr;
>  		unsigned long end = end_addr;
>  		hugetlb_zap_begin(vma, &start, &end);
> -		unmap_single_vma(tlb, vma, start, end, &details,
> -				 mm_wr_locked);
> +		unmap_single_vma(tlb, vma, start, end, &details);
>  		hugetlb_zap_end(vma, &details);
>  		vma = mas_find(mas, tree_end - 1);
>  	} while (vma && likely(!xa_is_zero(vma)));
> @@ -2139,7 +2135,7 @@ void zap_page_range_single_batched(struct mmu_gather *tlb,
>  	 * unmap 'address-end' not 'range.start-range.end' as range
>  	 * could have been expanded for hugetlb pmd sharing.
>  	 */
> -	unmap_single_vma(tlb, vma, address, end, details, false);
> +	unmap_single_vma(tlb, vma, address, end, details);
>  	mmu_notifier_invalidate_range_end(&range);
>  	if (is_vm_hugetlb_page(vma)) {
>  		/*
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 644f02071a41..4f51ca644903 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -1274,7 +1274,7 @@ void exit_mmap(struct mm_struct *mm)
>  	tlb_gather_mmu_fullmm(&tlb, mm);
>  	/* update_hiwater_rss(mm) here? but nobody should be looking */
>  	/* Use ULONG_MAX here to ensure all VMAs in the mm are unmapped */
> -	unmap_vmas(&tlb, &vmi.mas, vma, 0, ULONG_MAX, ULONG_MAX, false);
> +	unmap_vmas(&tlb, &vmi.mas, vma, 0, ULONG_MAX, ULONG_MAX);
>  	mmap_read_unlock(mm);
>  
>  	/*
> diff --git a/mm/vma.c b/mm/vma.c
> index 919d1fc63a52..0c5e391fe2e2 100644
> --- a/mm/vma.c
> +++ b/mm/vma.c
> @@ -483,8 +483,7 @@ void unmap_region(struct ma_state *mas, struct vm_area_struct *vma,
>  
>  	tlb_gather_mmu(&tlb, mm);
>  	update_hiwater_rss(mm);
> -	unmap_vmas(&tlb, mas, vma, vma->vm_start, vma->vm_end, vma->vm_end,
> -		   /* mm_wr_locked = */ true);
> +	unmap_vmas(&tlb, mas, vma, vma->vm_start, vma->vm_end, vma->vm_end);
>  	mas_set(mas, vma->vm_end);
>  	free_pgtables(&tlb, mas, vma, prev ? prev->vm_end : FIRST_USER_ADDRESS,
>  		      next ? next->vm_start : USER_PGTABLES_CEILING,
> @@ -1228,7 +1227,7 @@ static inline void vms_clear_ptes(struct vma_munmap_struct *vms,
>  	tlb_gather_mmu(&tlb, vms->vma->vm_mm);
>  	update_hiwater_rss(vms->vma->vm_mm);
>  	unmap_vmas(&tlb, mas_detach, vms->vma, vms->start, vms->end,
> -		   vms->vma_count, mm_wr_locked);
> +		   vms->vma_count);
>  
>  	mas_set(mas_detach, 1);
>  	/* start and end may be different if there is no prev or next vma. */
> diff --git a/tools/testing/vma/vma_internal.h b/tools/testing/vma/vma_internal.h
> index d873667704e8..c68d382dac81 100644
> --- a/tools/testing/vma/vma_internal.h
> +++ b/tools/testing/vma/vma_internal.h
> @@ -848,8 +848,7 @@ static inline void update_hiwater_vm(struct mm_struct *mm)
>  
>  static inline void unmap_vmas(struct mmu_gather *tlb, struct ma_state *mas,
>  		      struct vm_area_struct *vma, unsigned long start_addr,
> -		      unsigned long end_addr, unsigned long tree_end,
> -		      bool mm_wr_locked)
> +		      unsigned long end_addr, unsigned long tree_end)
>  {
>  }
>  
> -- 
> 2.27.0
> 


      parent reply	other threads:[~2025-11-06 16:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04  8:57 Kefeng Wang
2025-11-04  9:29 ` Lorenzo Stoakes
2025-11-06 10:12 ` David Hildenbrand (Red Hat)
2025-11-06 16:34 ` Liam R. Howlett [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=xuyrhqdyceyhcdwecgb5zghgyolorewskx5yxxeqjhs2cpeziu@s7llff42vxai \
    --to=liam.howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=wangkefeng.wang@huawei.com \
    /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