From: Michal Hocko <mhocko@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Xu <peterx@redhat.com>, Linux-MM <linux-mm@kvack.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Hillf Danton <hdanton@sina.com>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
syzbot+3be1a33f04dc782e9fd5@syzkaller.appspotmail.com
Subject: Re: [PATCH] mm/gup: Let __get_user_pages_locked() return -EINTR for fatal signal
Date: Wed, 8 Apr 2020 19:13:10 +0200 [thread overview]
Message-ID: <20200408171023.GC18914@dhcp22.suse.cz> (raw)
In-Reply-To: <CAHk-=wjR=rtvm21=yP_1tqscXpOSEVpZaJ+oBAD8qU9ZKeZEWQ@mail.gmail.com>
On Wed 08-04-20 09:20:00, Linus Torvalds wrote:
> On Wed, Apr 8, 2020 at 8:59 AM Peter Xu <peterx@redhat.com> wrote:
> >
> > __get_user_pages_locked() will return 0 instead of -EINTR after commit
> > 4426e945df588 which added extra code to allow gup detect fatal signal
> > faster. Restore that behavior.
>
> I've applied this, but it's worth noting that
> __get_user_pages_locked() can still return 0 in other situations.
>
> I realize that "I got zero pages" is a valid return value, but I do
> wonder if we should make the rule be that a zero return value isn't
> possible (return -EAGAIN or whatever if you doin't have the
> EFAULT/EINTR conditions).
>
> So that you'd always get either an error, or a successful number of pages.
>
> The only case where __get_user_pages_locked() might return zero is if
> you pass in a zero 'nr_pages', although I suspect even for that case
> returning -EINVAL might be a better option.
Yeah, that makes sense to me. And get_user_pages_locked documentation
would benefit from an actual documentation as well. What we have right
now is more suited to the lower level (__get_user_pages_locked) and have
a high level user oriented documentation.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2020-04-08 17:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-08 15:59 Peter Xu
2020-04-08 16:20 ` Linus Torvalds
2020-04-08 17:13 ` Michal Hocko [this message]
2020-04-08 17:27 ` Peter Zijlstra
2020-04-08 17:32 ` Linus Torvalds
2020-04-09 2:27 ` Hillf Danton
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=20200408171023.GC18914@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterx@redhat.com \
--cc=peterz@infradead.org \
--cc=syzbot+3be1a33f04dc782e9fd5@syzkaller.appspotmail.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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