From: Linus Torvalds <torvalds@linux-foundation.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Arjun Roy <arjunroy.kdev@gmail.com>,
David Miller <davem@davemloft.net>,
Netdev <netdev@vger.kernel.org>, Linux-MM <linux-mm@kvack.org>,
arjunroy@google.com, Eric Dumazet <edumazet@google.com>,
Soheil Hassas Yeganeh <soheil@google.com>
Subject: Re: [PATCH resend mm,net-next 2/3] mm: Add vm_insert_pages().
Date: Thu, 13 Feb 2020 13:37:40 -0800 [thread overview]
Message-ID: <CAHk-=whXrLfFrgJKrLUCXB0_ncXAetOqp7Crv4pqmKfiEjh4=w@mail.gmail.com> (raw)
In-Reply-To: <20200212184101.b8551710bd19c8216d62290d@linux-foundation.org>
On Wed, Feb 12, 2020 at 6:41 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> Also, vm_insert_page() does
>
> if (!page_count(page))
> return -EINVAL;
>
> and this was not carried over into vm_insert_pages(). How come?
Sounds like that was just a mistake.
> I don't know what that test does - it was added by Linus in the
> original commit a145dd411eb28c83. It's only been 15 years so I'm sure
> he remembers ;)
Oh, sure.
No, I have absolutely no memory of the details, but I think the commit
message is actually the big hint: the difference between
vm_insert_page() and some of the more random "insert any pdf" cases we
have is exactly that:
The page you insert needs to be a nice clean kernel allocation, so you
can't insert arbitrary page mappings with this, but that's not what
people want.
thing. The comment above it also kind of hints at it.
We *historically* had interfaces to insert random reserved pages (for
IO mappings, but also the zero page etc), but the whole point of that
vm_insert_page() is that it's now an interface for drivers to insert
the pages they maintain into the page tables.
But that also means that we very much didn't allow just random pages
accessed by doing pfn lookups (that might not be in use at all).
Is "page_count()" a great test? No. But it's at least _a_ test of
that. No reserved pages or other magic need apply.
Linus
next prev parent reply other threads:[~2020-02-13 21:38 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-28 2:59 [PATCH resend mm,net-next 1/3] mm: Refactor insert_page to prepare for batched-lock insert Arjun Roy
2020-01-28 2:59 ` [PATCH resend mm,net-next 2/3] mm: Add vm_insert_pages() Arjun Roy
2020-02-13 2:41 ` Andrew Morton
2020-02-13 17:09 ` Arjun Roy
2020-02-13 21:37 ` Linus Torvalds [this message]
2020-02-13 21:54 ` Matthew Wilcox
2020-02-13 22:06 ` Arjun Roy
2020-01-28 2:59 ` [PATCH resend mm,net-next 3/3] net-zerocopy: Use vm_insert_pages() for tcp rcv zerocopy Arjun Roy
2020-02-13 2:56 ` Andrew Morton
2020-02-17 2:49 ` Arjun Roy
2020-02-21 21:21 ` Arjun Roy
2020-02-24 3:37 ` Andrew Morton
2020-02-24 16:19 ` Arjun Roy
2020-04-10 19:04 ` Andrew Morton
2020-04-10 19:13 ` Arjun Roy
2020-04-10 19:15 ` Arjun Roy
2020-02-13 2:41 ` [PATCH resend mm,net-next 1/3] mm: Refactor insert_page to prepare for batched-lock insert Andrew Morton
2020-02-13 16:52 ` Arjun Roy
2020-02-13 16:55 ` Arjun Roy
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='CAHk-=whXrLfFrgJKrLUCXB0_ncXAetOqp7Crv4pqmKfiEjh4=w@mail.gmail.com' \
--to=torvalds@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=arjunroy.kdev@gmail.com \
--cc=arjunroy@google.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.org \
--cc=soheil@google.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;
as well as URLs for NNTP newsgroup(s).