linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Lutomirski <luto@kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Josef Bacik <josef@toxicpanda.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	Dan Carpenter <dan.carpenter@linaro.org>,
	syzbot+48011b86c8ea329af1b9@syzkaller.appspotmail.com,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] filemap: Handle error return from __filemap_get_folio()
Date: Wed, 10 May 2023 21:45:23 -0700	[thread overview]
Message-ID: <ZFxy48TRh3m09oWB@x1n> (raw)
In-Reply-To: <CAHk-=wgnHtP2uNtnFdQ4Ou-TZynipVVU5Jow+Fr8nhRgewkXAA@mail.gmail.com>

On Wed, May 10, 2023 at 04:44:59PM -0500, Linus Torvalds wrote:
> On Wed, May 10, 2023 at 4:33 PM Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
> >
> > We'd still keep the RETRY bit as a "this did not complete, you need to
> > retry", but at least the whole secondary meaning of "oh, and if it
> > isn't set, you need to release the lock you took" would go away.
> 
> "unless VM_FAULT_COMPLETED is set, in which case everything was fine,
> and you shouldn't release the lock because we already released it".
> 
> I completely forgot about that wart that came in last year.
> 
> I think that if we made handle_mm_fault() always unlock, that thing
> would go away entirely, since "0" would now just mean the same thing.
> 
> Is there really any case that *wants* to keep the mmap lock held, and
> couldn't just always re-take it if it needs to do another page
> (possibly retry, but the retry case obviously already has that issue)?

FAULT_FLAG_RETRY_NOWAIT?

> Certainly nothing wants the vma lock, so it's only the "mmap_sem" case
> that would be an issue.

You're definitely right that the gup path is broken which I didn't notice
when reading...  I know I shouldn't review such a still slightly involved
patch during travel. :(

I still think maybe we have chance to generalize at least the fault path,
I'd still start with something like having just 2-3 archs having a shared
routine handle only some part of the fault path (I remember there was a
previous discussion previously, but I didn't follow up much from there..).

So even if we still need duplicates over many archs, we'll start to have
something we can use as a baseline in fault path.  Does it sound a sane
thing to consider as a start, or maybe not?

The other question - considering RETRY_NOWAIT being there - do we still
want to have something like what Johannes proposed first to fix the problem
(with all arch and gup fixed)?  I'd think yes, but I could missed something.

Thanks,

-- 
Peter Xu



  reply	other threads:[~2023-05-11  6:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-06 16:04 Matthew Wilcox (Oracle)
2023-05-06 16:09 ` Linus Torvalds
2023-05-06 16:35   ` Linus Torvalds
2023-05-06 17:04     ` Linus Torvalds
2023-05-06 17:10       ` Linus Torvalds
2023-05-06 17:34         ` Linus Torvalds
2023-05-06 17:41           ` Andrew Morton
2023-05-08 13:56             ` Dan Carpenter
2023-05-09  7:43               ` Dan Carpenter
2023-05-09 17:37                 ` Linus Torvalds
2023-05-09 20:49                   ` Christoph Hellwig
2023-05-11  9:44                   ` Dan Carpenter
2023-05-09 19:19       ` Johannes Weiner
2023-05-10 20:27         ` Peter Xu
2023-05-10 21:33           ` Linus Torvalds
2023-05-10 21:44             ` Linus Torvalds
2023-05-11  4:45               ` Peter Xu [this message]
2023-05-12  0:14                 ` Peter Xu
2023-05-12  3:28                   ` [PATCH 1/3] mm: handle_mm_fault_one() kernel test robot
2023-05-12  3:52                   ` kernel test robot
2023-05-12  3:52                   ` kernel test robot
2023-05-12  4:49                   ` kernel test robot

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=ZFxy48TRh3m09oWB@x1n \
    --to=peterx@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@linaro.org \
    --cc=hannes@cmpxchg.org \
    --cc=hch@lst.de \
    --cc=josef@toxicpanda.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=syzbot+48011b86c8ea329af1b9@syzkaller.appspotmail.com \
    --cc=torvalds@linux-foundation.org \
    --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