linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Suren Baghdasaryan <surenb@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	maple-tree@lists.infradead.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	David Hildenbrand <david@redhat.com>,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	Vlastimil Babka <vbabka@suse.cz>, Michal Hocko <mhocko@suse.com>,
	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: [PATCH v1 3/9] mm/vma: Add limits to unmap_region() for vmas
Date: Tue, 13 Jan 2026 13:51:47 -0500	[thread overview]
Message-ID: <keo5dm3fcn4upqdf2xt7epdkkgsryjgemaz4ng5r6sytkkpgon@gbnqq35blm7n> (raw)
In-Reply-To: <CAJuCfpGSX3VMnFH3u67mKZTe1pXOYXoFc92XiU+TVjPs==5mcA@mail.gmail.com>

* Suren Baghdasaryan <surenb@google.com> [250909 16:10]:
> On Tue, Sep 9, 2025 at 12:10 PM Liam R. Howlett <Liam.Howlett@oracle.com> wrote:
> >
> > Add a limit to the vma search instead of using the start and end of the
> > one passed in.
> 
> Would be good to explain why this is needed. I'm sure I'll find the
> answer in the later patches though.

I'll try to expand this comment to include why.

> 
> 
> >
> > No functional changes intended.
> >
> > Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
> 
> Reviewed-by: Suren Baghdasaryan <surenb@google.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 abe0da33c8446..a648e0555c873 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)
> >  {
> >         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 9183fe5490090..a9d0cef684ddb 100644
> > --- a/mm/vma.h
> > +++ b/mm/vma.h
> > @@ -261,6 +261,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
> >


  reply	other threads:[~2026-01-13 18:52 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09 19:09 [PATCH v1 0/9] Remove XA_ZERO from error recovery of dup_mmap() Liam R. Howlett
2025-09-09 19:09 ` [PATCH v1 1/9] mm/mmap: Move exit_mmap() trace point Liam R. Howlett
2025-09-09 20:07   ` Suren Baghdasaryan
2025-09-10 12:51   ` Pedro Falcato
2025-09-11  9:19   ` David Hildenbrand
2025-09-09 19:09 ` [PATCH v1 2/9] mm/mmap: Abstract vma clean up from exit_mmap() Liam R. Howlett
2025-09-09 20:09   ` Suren Baghdasaryan
2026-01-13 18:50     ` Liam R. Howlett
2025-09-10 12:54   ` Pedro Falcato
2025-09-11  9:21   ` David Hildenbrand
2026-01-13 18:51     ` Liam R. Howlett
2025-09-09 19:09 ` [PATCH v1 3/9] mm/vma: Add limits to unmap_region() for vmas Liam R. Howlett
2025-09-09 20:09   ` Suren Baghdasaryan
2026-01-13 18:51     ` Liam R. Howlett [this message]
2025-09-10 12:56   ` Pedro Falcato
2025-09-11  8:56   ` Lorenzo Stoakes
2025-09-11  9:22   ` David Hildenbrand
2025-09-09 19:09 ` [PATCH v1 4/9] mm/memory: Add tree limit to free_pgtables() Liam R. Howlett
2025-09-09 21:05   ` Suren Baghdasaryan
2026-01-13 19:14     ` Liam R. Howlett
2025-09-10 13:08   ` Pedro Falcato
2025-09-11  9:08   ` Lorenzo Stoakes
2026-01-13 19:48     ` Liam R. Howlett
2025-09-11  9:24   ` David Hildenbrand
2026-01-13 19:19     ` Liam R. Howlett
2025-09-09 19:09 ` [PATCH v1 5/9] mm/vma: Add page table limit to unmap_region() Liam R. Howlett
2025-09-09 21:29   ` Suren Baghdasaryan
2026-01-13 20:09     ` Liam R. Howlett
2025-09-10 13:08   ` Pedro Falcato
2025-09-09 19:09 ` [PATCH v1 6/9] mm: Change dup_mmap() recovery Liam R. Howlett
2025-09-09 22:03   ` Suren Baghdasaryan
2025-09-10 13:23   ` Pedro Falcato
2025-09-11  9:13   ` Lorenzo Stoakes
2025-09-11  9:31   ` David Hildenbrand
2025-09-09 19:09 ` [PATCH v1 7/9] mm: Introduce unmap_desc struct to reduce function arguments Liam R. Howlett
2025-09-09 21:44   ` Suren Baghdasaryan
2025-09-11  9:22     ` Lorenzo Stoakes
2025-09-11 16:51       ` Suren Baghdasaryan
2025-09-11 16:56         ` Liam R. Howlett
2025-09-11 17:03           ` Suren Baghdasaryan
2025-09-10 13:10   ` Pedro Falcato
2025-09-11  9:20   ` Lorenzo Stoakes
2025-09-09 19:09 ` [PATCH v1 8/9] mm/vma: Use unmap_desc in vms_clear_ptes() and exit_mmap() Liam R. Howlett
2025-09-09 22:16   ` Suren Baghdasaryan
2025-09-11 16:59     ` Liam R. Howlett
2025-09-11  9:53   ` Lorenzo Stoakes
2025-09-12  5:08   ` kernel test robot
2025-09-09 19:09 ` [PATCH v1 9/9] mm: Use unmap_desc struct for freeing page tables Liam R. Howlett
2025-09-09 22:27   ` Suren Baghdasaryan
2025-09-11 10:06   ` 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=keo5dm3fcn4upqdf2xt7epdkkgsryjgemaz4ng5r6sytkkpgon@gbnqq35blm7n \
    --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=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