From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: David Hildenbrand <david@redhat.com>,
maple-tree@lists.infradead.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Vlastimil Babka <vbabka@suse.cz>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jann Horn <jannh@google.com>, Pedro Falcato <pfalcato@suse.de>,
Charan Teja Kalla <quic_charante@quicinc.com>,
shikemeng@huaweicloud.com, kasong@tencent.com, nphamcs@gmail.com,
bhe@redhat.com, baohua@kernel.org, chrisl@kernel.org,
Matthew Wilcox <willy@infradead.org>
Subject: Re: [RFC PATCH 3/6] mm/vma: Add limits to unmap_region() for vmas
Date: Wed, 3 Sep 2025 15:57:37 -0400 [thread overview]
Message-ID: <w43jgvlabgvxpq2jb3zv7zo64r4xbvmad7cf75l3keests7djf@lmqslvejyyk4> (raw)
In-Reply-To: <a32ea375-f093-4f8f-9270-fbe9f7977cc6@lucifer.local>
* Lorenzo Stoakes <lorenzo.stoakes@oracle.com> [250819 14:48]:
> On Fri, Aug 15, 2025 at 03:10:28PM -0400, Liam R. Howlett wrote:
> > Add a limit to the vma search instead of using the start and end of the
> > one passed in.
> >
> > No functional changes intended.
> >
> > Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
> > ---
> > mm/vma.c | 6 ++++--
> > mm/vma.h | 1 +
> > 2 files changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/mm/vma.c b/mm/vma.c
> > index 3b12c7579831b..fd270345c25d3 100644
> > --- a/mm/vma.c
> > +++ b/mm/vma.c
> > @@ -474,6 +474,7 @@ void remove_vma(struct vm_area_struct *vma)
> > * Called with the mm semaphore held.
> > */
> > void unmap_region(struct ma_state *mas, struct vm_area_struct *vma,
> > + unsigned long vma_min, unsigned long vma_max,
> > struct vm_area_struct *prev, struct vm_area_struct *next)
>
> Luckily we will be getting rid of this as soon as I complete the mmap_prepare +
> friends series (_actively_ working on this right now).
>
> Anyway, this is getting quickly horrid, since this is only in vma.c, we could
> make this static and pass through map to reduce some of the horror?
>
> We actually can hand it vmi (and thus &vmi->mas via map, so we could implement
> it as:
>
> void unmap_region(struct mmap_state *map, struct vm_area_struct *vma,
> unsigned long min, unsigned long max);
>
Ah... I could do this on top of the last patch.. that might be more
clear?
> > {
> > struct mm_struct *mm = vma->vm_mm;
> > @@ -481,7 +482,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,
> > + unmap_vmas(&tlb, mas, vma, vma_min, vma_max, vma_max,
> > /* mm_wr_locked = */ true);
> > mas_set(mas, vma->vm_end);
> > free_pgtables(&tlb, mas, vma, prev ? prev->vm_end : FIRST_USER_ADDRESS,
> > @@ -2417,7 +2418,8 @@ static int __mmap_new_file_vma(struct mmap_state *map,
> >
> > vma_iter_set(vmi, vma->vm_end);
> > /* Undo any partial mapping done by a device driver. */
> > - unmap_region(&vmi->mas, vma, map->prev, map->next);
> > + unmap_region(&vmi->mas, vma, vma->vm_start, vma->vm_end,
> > + map->prev, map->next);
> >
> > return error;
> > }
> > diff --git a/mm/vma.h b/mm/vma.h
> > index b123a9cdedb0d..336dae295853e 100644
> > --- a/mm/vma.h
> > +++ b/mm/vma.h
> > @@ -281,6 +281,7 @@ int do_vmi_munmap(struct vma_iterator *vmi, struct mm_struct *mm,
> > void remove_vma(struct vm_area_struct *vma);
> >
> > void unmap_region(struct ma_state *mas, struct vm_area_struct *vma,
> > + unsigned long min, unsigned long max,
> > struct vm_area_struct *prev, struct vm_area_struct *next);
> >
> > /* We are about to modify the VMA's flags. */
> > --
> > 2.47.2
> >
next prev parent reply other threads:[~2025-09-03 19:58 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-15 19:10 [RFC PATCH 0/6] Remove XA_ZERO from error recovery of Liam R. Howlett
2025-08-15 19:10 ` [RFC PATCH 1/6] mm/mmap: Move exit_mmap() trace point Liam R. Howlett
2025-08-19 18:27 ` Lorenzo Stoakes
2025-08-21 21:12 ` Chris Li
2025-08-15 19:10 ` [RFC PATCH 2/6] mm/mmap: Abstract vma clean up from exit_mmap() Liam R. Howlett
2025-08-19 18:38 ` Lorenzo Stoakes
2025-09-03 19:56 ` Liam R. Howlett
2025-09-04 15:21 ` Lorenzo Stoakes
2025-08-15 19:10 ` [RFC PATCH 3/6] mm/vma: Add limits to unmap_region() for vmas Liam R. Howlett
2025-08-19 18:48 ` Lorenzo Stoakes
2025-09-03 19:57 ` Liam R. Howlett [this message]
2025-09-04 15:23 ` Lorenzo Stoakes
2025-08-15 19:10 ` [RFC PATCH 4/6] mm/memory: Add tree limit to free_pgtables() Liam R. Howlett
2025-08-18 15:36 ` Lorenzo Stoakes
2025-08-18 15:54 ` Liam R. Howlett
2025-08-19 19:14 ` Lorenzo Stoakes
2025-09-03 20:19 ` Liam R. Howlett
2025-09-04 10:20 ` David Hildenbrand
2025-09-04 15:36 ` Lorenzo Stoakes
2025-09-09 17:19 ` Liam R. Howlett
2025-09-04 15:33 ` Lorenzo Stoakes
2025-08-15 19:10 ` [RFC PATCH 5/6] mm/vma: Add page table limit to unmap_region() Liam R. Howlett
2025-08-19 19:27 ` Lorenzo Stoakes
2025-08-15 19:10 ` [RFC PATCH 6/6] mm: Change dup_mmap() recovery Liam R. Howlett
2025-08-18 15:12 ` Lorenzo Stoakes
2025-08-18 15:29 ` Lorenzo Stoakes
2025-08-19 20:33 ` Lorenzo Stoakes
2025-09-04 0:13 ` Liam R. Howlett
2025-09-04 15:40 ` Lorenzo Stoakes
2025-08-15 19:49 ` [RFC PATCH 0/6] Remove XA_ZERO from error recovery of Jann Horn
2025-08-18 15:48 ` Liam R. Howlett
2025-08-18 9:44 ` David Hildenbrand
2025-08-18 14:26 ` Charan Teja Kalla
2025-08-18 14:54 ` Liam R. Howlett
2025-08-18 15:47 ` Lorenzo Stoakes
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=w43jgvlabgvxpq2jb3zv7zo64r4xbvmad7cf75l3keests7djf@lmqslvejyyk4 \
--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=maple-tree@lists.infradead.org \
--cc=mhocko@suse.com \
--cc=nphamcs@gmail.com \
--cc=pfalcato@suse.de \
--cc=quic_charante@quicinc.com \
--cc=rppt@kernel.org \
--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