linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Suren Baghdasaryan <surenb@google.com>,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	Pedro Falcato <pfalcato@suse.de>,
	David Hildenbrand <david@redhat.com>,
	Vlastimil Babka <vbabka@suse.cz>, Michal Hocko <mhocko@suse.com>,
	Jann Horn <jannh@google.com>,
	shikemeng@huaweicloud.com, kasong@tencent.com, nphamcs@gmail.com,
	bhe@redhat.com, baohua@kernel.org, chrisl@kernel.org,
	Matthew Wilcox <willy@infradead.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>
Subject: [PATCH v2 09/10] mm/vma: Use unmap_region() in vms_clear_ptes()
Date: Thu, 15 Jan 2026 13:27:19 -0500	[thread overview]
Message-ID: <20260115182720.1691130-10-Liam.Howlett@oracle.com> (raw)
In-Reply-To: <20260115182720.1691130-1-Liam.Howlett@oracle.com>

There is no need to open code the vms_clear_ptes() now that unmap_desc
struct is used.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
---
 mm/vma.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/mm/vma.c b/mm/vma.c
index b46c869d4bb07..876d2db5329dd 100644
--- a/mm/vma.c
+++ b/mm/vma.c
@@ -1255,7 +1255,6 @@ int vma_shrink(struct vma_iterator *vmi, struct vm_area_struct *vma,
 static inline void vms_clear_ptes(struct vma_munmap_struct *vms,
 		    struct ma_state *mas_detach, bool mm_wr_locked)
 {
-	struct mmu_gather tlb;
 	struct unmap_desc unmap = {
 		.mas = mas_detach,
 		.first = vms->vma,
@@ -1280,19 +1279,8 @@ static inline void vms_clear_ptes(struct vma_munmap_struct *vms,
 	if (!vms->clear_ptes) /* Nothing to do */
 		return;
 
-	/*
-	 * We can free page tables without write-locking mmap_lock because VMAs
-	 * were isolated before we downgraded mmap_lock.
-	 */
 	mas_set(mas_detach, 1);
-	tlb_gather_mmu(&tlb, vms->vma->vm_mm);
-	update_hiwater_rss(vms->vma->vm_mm);
-	unmap_vmas(&tlb, &unmap);
-	mas_set(mas_detach, 1);
-	/* start and end may be different if there is no prev or next vma. */
-	free_pgtables(&tlb, mas_detach, vms->vma, vms->unmap_start,
-		      vms->unmap_end, vms->unmap_end, mm_wr_locked);
-	tlb_finish_mmu(&tlb);
+	unmap_region(&unmap);
 	vms->clear_ptes = false;
 }
 
-- 
2.47.3



  parent reply	other threads:[~2026-01-15 18:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15 18:27 [PATCH v2 00/10] Remove XA_ZERO from error recovery of dup_mmap() Liam R. Howlett
2026-01-15 18:27 ` [PATCH v2 01/10] mm/mmap: Move exit_mmap() trace point Liam R. Howlett
2026-01-15 18:27 ` [PATCH v2 02/10] mm/mmap: Abstract vma clean up from exit_mmap() Liam R. Howlett
2026-01-15 18:27 ` [PATCH v2 03/10] mm/vma: Add limits to unmap_region() for vmas Liam R. Howlett
2026-01-15 18:27 ` [PATCH v2 04/10] mm/memory: Add tree limit to free_pgtables() Liam R. Howlett
2026-01-15 18:27 ` [PATCH v2 05/10] mm/vma: Add page table limit to unmap_region() Liam R. Howlett
2026-01-15 18:27 ` [PATCH v2 06/10] mm: Change dup_mmap() recovery Liam R. Howlett
2026-01-15 18:27 ` [PATCH v2 07/10] mm: Introduce unmap_desc struct to reduce function arguments Liam R. Howlett
2026-01-15 18:27 ` [PATCH v2 08/10] mm/vma: Use unmap_desc in exit_mmap() and vms_clear_ptes() Liam R. Howlett
2026-01-16  1:30   ` kernel test robot
2026-01-16 17:55     ` Liam R. Howlett
2026-01-16 19:48       ` Liam R. Howlett
2026-01-16  2:04   ` kernel test robot
2026-01-16  8:27     ` Lorenzo Stoakes
2026-01-16 16:15       ` Liam R. Howlett
2026-01-17  1:07         ` SeongJae Park
2026-01-17  3:25           ` Andrew Morton
2026-01-15 18:27 ` Liam R. Howlett [this message]
2026-01-15 18:27 ` [PATCH v2 10/10] mm: Use unmap_desc struct for freeing page tables Liam R. Howlett
2026-01-15 19:01 ` [PATCH v2 00/10] Remove XA_ZERO from error recovery of dup_mmap() Andrew Morton

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=20260115182720.1691130-10-Liam.Howlett@oracle.com \
    --to=liam.howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=bhe@redhat.com \
    --cc=chrisl@kernel.org \
    --cc=david@redhat.com \
    --cc=jannh@google.com \
    --cc=kasong@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mhocko@suse.com \
    --cc=nphamcs@gmail.com \
    --cc=pfalcato@suse.de \
    --cc=shikemeng@huaweicloud.com \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.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