linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Barry Song <21cnbao@gmail.com>,
	linux-mm@kvack.org, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org, Barry Song <v-songbaohua@oppo.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	David Hildenbrand <david@redhat.com>,
	Oscar Salvador <osalvador@suse.de>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Jann Horn <jannh@google.com>,
	Suren Baghdasaryan <surenb@google.com>,
	Lokesh Gidra <lokeshgidra@google.com>,
	Dev Jain <dev.jain@arm.com>,
	Tangquan Zheng <zhengtangquan@oppo.com>
Subject: Re: [PATCH v2] mm: madvise: use walk_page_range_vma() instead of walk_page_range()
Date: Thu, 5 Jun 2025 15:20:40 +0100	[thread overview]
Message-ID: <0abf8a75-24fb-4bce-8071-6ae654e62451@lucifer.local> (raw)
In-Reply-To: <452a0296-7cdc-474b-b751-0c6c498e4190@suse.cz>

On Thu, Jun 05, 2025 at 04:12:48PM +0200, Vlastimil Babka wrote:
> On 6/5/25 10:31, Barry Song wrote:
> > From: Barry Song <v-songbaohua@oppo.com>
> >
> > We've already found the VMA within madvise_walk_vmas() before calling
> > specific madvise behavior functions like madvise_free_single_vma().
> > So calling walk_page_range() and doing find_vma() again seems
> > unnecessary. It also prevents potential optimizations in those madvise
> > callbacks, particularly the use of dedicated per-VMA locking.
> >
> > Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
> > Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> > Acked-by: David Hildenbrand <david@redhat.com>
> > Reviewed-by: Oscar Salvador <osalvador@suse.de>
> > Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>
> > Cc: Vlastimil Babka <vbabka@suse.cz>
> > Cc: Jann Horn <jannh@google.com>
> > Cc: Suren Baghdasaryan <surenb@google.com>
> > Cc: Lokesh Gidra <lokeshgidra@google.com>
> > Cc: Dev Jain <dev.jain@arm.com>
> > Cc: Tangquan Zheng <zhengtangquan@oppo.com>
> > Signed-off-by: Barry Song <v-songbaohua@oppo.com>
>
> Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
>
> Thanks!
>
> > @@ -1160,7 +1160,7 @@ static long madvise_guard_install(struct vm_area_struct *vma,
> >  		unsigned long nr_pages = 0;
> >
> >  		/* Returns < 0 on error, == 0 if success, > 0 if zap needed. */
> > -		err = walk_page_range_mm(vma->vm_mm, start, end,
> > +		err = walk_page_range_vma(vma, start, end,
> >  					 &guard_install_walk_ops, &nr_pages);
>
> Nit: breaks the parameter alignment. Do we care? It's Lorenzo's code so
> maybe not ;P

OMG!!

Nah it's fine leave it as-is :P

Can always go fix it up at some later date... or make it more sane with just tab
alignment...

>
> >  		if (err < 0)
> >  			return err;
> > @@ -1244,7 +1244,7 @@ static long madvise_guard_remove(struct vm_area_struct *vma,
> >  	if (!is_valid_guard_vma(vma, /* allow_locked = */true))
> >  		return -EINVAL;
> >
> > -	return walk_page_range(vma->vm_mm, start, end,
> > +	return walk_page_range_vma(vma, start, end,
> >  			       &guard_remove_walk_ops, NULL);
>
> Same.
>
> >  }
> >
>


  reply	other threads:[~2025-06-05 14:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05  8:31 Barry Song
2025-06-05  9:14 ` Harry Yoo
2025-06-05  9:20 ` Dev Jain
2025-06-05 14:12 ` Vlastimil Babka
2025-06-05 14:20   ` Lorenzo Stoakes [this message]
2025-06-09  9:52 ` Ryan Roberts
2025-06-09 10:22   ` Lorenzo Stoakes
2025-06-09 10:55     ` Barry Song
2025-06-09 11:04       ` Ryan Roberts
2025-06-09 11:12       ` 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=0abf8a75-24fb-4bce-8071-6ae654e62451@lucifer.local \
    --to=lorenzo.stoakes@oracle.com \
    --cc=21cnbao@gmail.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=david@redhat.com \
    --cc=dev.jain@arm.com \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lokeshgidra@google.com \
    --cc=osalvador@suse.de \
    --cc=surenb@google.com \
    --cc=v-songbaohua@oppo.com \
    --cc=vbabka@suse.cz \
    --cc=zhengtangquan@oppo.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