From: Arjun Roy <arjunroy@google.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Brian Geffon <bgeffon@google.com>,
Justin Green <greenjustin@chromium.org>,
akpm@linux-foundation.org, linux-mm@kvack.org, david@kernel.org,
lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com,
vbabka@suse.cz, rppt@kernel.org, surenb@google.com,
mhocko@suse.com, linux-kernel@vger.kernel.org,
greenjustin@google.com, rientjes@google.com
Subject: Re: [PATCH] mm: Refactor vma_map_pages to use vm_insert_pages
Date: Wed, 28 Jan 2026 20:44:52 -0800 [thread overview]
Message-ID: <CAOFY-A3Z92AeGVCGFPe=8i6NJVoksPojuHO4hC+tOzpKiNBtUA@mail.gmail.com> (raw)
In-Reply-To: <aXqu-pe6kR4VDOnT@casper.infradead.org>
On Wed, Jan 28, 2026 at 4:51 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Wed, Jan 28, 2026 at 05:59:12PM -0500, Brian Geffon wrote:
> > On Wed, Jan 28, 2026 at 5:57 PM Justin Green <greenjustin@chromium.org> wrote:
> > >
> > > vma_map_pages currently calls vm_insert_page on each individual page in
> > > the mapping, which creates significant overhead because we are
> > > repeatedly spinlocking. Instead, we should batch insert pages using
> > > vm_insert_pages, which amortizes the cost of the spinlock.
> >
> > This makes sense, I wonder why this wasn't done previously?
>
> That's always a good question, because it might reveal why this patch is
> a bad idea ...
>
> However in this case, it simply seems to be an oversight.
> __vm_map_pages() was introduced in May 2019 and then vm_insert_pages()
> was added in April 2020.
>
Yes, it was an oversight. I had originally cooked up vm_insert_pages()
to amortize
that spinlock for TCP zerocopy receive, and had not noticed __vm_map_pages()
sitting right there.
Reviewed-by: Arjun Roy <arjunroy@google.com>
-Arjun
> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
prev parent reply other threads:[~2026-01-29 4:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 22:56 Justin Green
2026-01-28 22:59 ` Brian Geffon
2026-01-29 0:51 ` Matthew Wilcox
2026-01-29 4:44 ` Arjun Roy [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='CAOFY-A3Z92AeGVCGFPe=8i6NJVoksPojuHO4hC+tOzpKiNBtUA@mail.gmail.com' \
--to=arjunroy@google.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=bgeffon@google.com \
--cc=david@kernel.org \
--cc=greenjustin@chromium.org \
--cc=greenjustin@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=rientjes@google.com \
--cc=rppt@kernel.org \
--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