linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: David Howells <dhowells@redhat.com>
Cc: torvalds@linux-foundation.org, Ted Ts'o <tytso@mit.edu>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	viro@zeniv.linux.org.uk, linux-mm@kvack.org,
	linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	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 16:32:31 +0100	[thread overview]
Message-ID: <YNICj+bHUuIQCTFZ@casper.infradead.org> (raw)
In-Reply-To: <3221175.1624375240@warthog.procyon.org.uk>

On Tue, Jun 22, 2021 at 04:20:40PM +0100, David Howells wrote:
> and wondering if the iov_iter_fault_in_readable() is actually effective.  Yes,
> it can make sure that the page we're intending to modify is dragged into the
> pagecache and marked uptodate so that it can be read from, but is it possible
> for the page to then get reclaimed before we get to
> iov_iter_copy_from_user_atomic()?  a_ops->write_begin() could potentially take
> a long time, say if it has to go and get a lock/lease from a server.

It's certainly possible, but unlikely.  The page is going to go to the
head of the active queue, and so we'll have to burn our way through the
entire inactive and then active queue in order to bump this page out
of memory.

> Also, I've been thinking about Willy's folio/THP stuff that allows bunches of
> pages to be glued together into single objects for efficiency.  This is
> problematic with the above code because the faultahead is limited to a maximum
> of PAGE_SIZE, but we might be wanting to modify a larger object than that.

Just to be clear, it's not _currently_ a problem for the folio patchset.

Multi-page folios are only created during readahead.  Unless there's a
read error during readahead, a folio found during write() will either
be freshly created and order-0, or it'll be multi-order and uptodate.
I would like to create larger folios during write() eventually, but I'm
choosing to not burden the folio patchset with that enhancement yet.
It has enough performance improvement to not need that yet.


  parent reply	other threads:[~2021-06-22 15:33 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
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 [this message]
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=YNICj+bHUuIQCTFZ@casper.infradead.org \
    --to=willy@infradead.org \
    --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 \
    /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).