linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nadav Amit <nadav.amit@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	David Howells <dhowells@redhat.com>,
	Al Viro <viro@zeniv.linux.org.uk>, Ted Ts'o <tytso@mit.edu>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux-MM <linux-mm@kvack.org>,
	Ext4 Developers List <linux-ext4@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Do we need to unrevert "fs: do not prefault sys_write() user buffer pages"?
Date: Tue, 22 Jun 2021 11:51:51 -0700	[thread overview]
Message-ID: <F78E1A78-DB7E-4F3A-8C7C-842AA757E4FE@gmail.com> (raw)
In-Reply-To: <YNItqqZA9Y1wOnZY@casper.infradead.org>



> On Jun 22, 2021, at 11:36 AM, Matthew Wilcox <willy@infradead.org> wrote:
> 
> On Tue, Jun 22, 2021 at 11:28:30AM -0700, Linus Torvalds wrote:
>> On Tue, Jun 22, 2021 at 11:23 AM Matthew Wilcox <willy@infradead.org> wrote:
>>> 
>>> It wouldn't be _that_ bad necessarily.  filemap_fault:
>> 
>> It's not actually the mm code that is the biggest problem. We
>> obviously already have readahead support.
>> 
>> It's the *fault* side.
>> 
>> In particular, since the fault would return without actually filling
>> in the page table entry (because the page isn't ready yet, and you
>> cannot expose it to other threads!), you also have to jump over the
>> instruction that caused this all.
> 
> Oh, I was assuming that it'd be a function call like
> get_user_pages_fast(), not an instruction that was specially marked to
> be jumped over.  Gag reflex diminishing now?

Just reminding the alternative (in the RFC that I mentioned before):
a vDSO exception table entry for a memory accessing function in the
vDSO. It then behaves as a sort of MADV_WILLNEED for the faulting
page if an exception is triggered. Unlike MADV_WILLNEED it maps the
page if no IO is needed. It can return through a register whether
the page was present or not.

I once implemented (another) alternative, in which the ELF had a section
with an exception-table (holding all the “Async-#PF” instructions),
which described where to skip to if a #PF occurs, but this solution
seemed too heavy-weight/intrusive.



  reply	other threads:[~2021-06-22 18:51 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22 15:20 Do we need to unrevert "fs: do not prefault sys_write() user buffer pages"? David Howells
2021-06-22 15:27 ` Al Viro
2021-06-22 15:36   ` Al Viro
2021-06-22 17:25     ` Matthew Wilcox
2021-06-22 17:39       ` Linus Torvalds
2021-06-22 17:55       ` David Howells
2021-06-22 18:04         ` Matthew Wilcox
2021-06-22 18:07           ` Linus Torvalds
2021-06-22 18:16             ` Nadav Amit
2021-06-22 18:23             ` Matthew Wilcox
2021-06-22 18:28               ` Linus Torvalds
2021-06-22 18:36                 ` Matthew Wilcox
2021-06-22 18:51                   ` Nadav Amit [this message]
2021-06-22 18:57                     ` Linus Torvalds
2021-06-22 18:23           ` David Howells
2021-06-22 18:32             ` Linus Torvalds
2021-06-22 18:13         ` David Howells
2021-06-22 15:32 ` Linus Torvalds
2021-06-22 15:53   ` Linus Torvalds
2021-06-22 15:32 ` Matthew Wilcox
2021-06-22 16:27 ` David Howells
2021-06-22 21:55   ` David Laight
2021-06-22 22:04     ` Matthew Wilcox
2021-06-22 22:31       ` David Laight
2021-06-22 22:20     ` Dave Chinner

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=F78E1A78-DB7E-4F3A-8C7C-842AA757E4FE@gmail.com \
    --to=nadav.amit@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=dhowells@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    --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;
as well as URLs for NNTP newsgroup(s).