From: Jason Gunthorpe <jgg@nvidia.com>
To: John Hubbard <jhubbard@nvidia.com>
Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux-MM <linux-mm@kvack.org>, Peter Xu <peterx@redhat.com>,
Alex Williamson <alex.williamson@redhat.com>,
Andrea Arcangeli <aarcange@redhat.com>,
David Hildenbrand <david@redhat.com>, Jan Kara <jack@suse.cz>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: Weird code with change "mm/gup: clean up follow_pfn_pte() slightly"
Date: Thu, 3 Feb 2022 21:26:07 -0400 [thread overview]
Message-ID: <20220204012607.GQ1786498@nvidia.com> (raw)
In-Reply-To: <afedd0c6-23c0-7e79-3b14-48fffaed7f99@nvidia.com>
On Thu, Feb 03, 2022 at 05:22:36PM -0800, John Hubbard wrote:
> > So why do we return 0, if it means an error, instead of returning the
> > actual errno?
>
> Well, now returning 0 sounds all wrong, when you put it like that. :)
>
> So, simply this approach? :
>
> @@ -1205,8 +1201,15 @@ static long __get_user_pages(struct mm_struct *mm,
> } else if (PTR_ERR(page) == -EEXIST) {
> /*
> * Proper page table entry exists, but no corresponding
> - * struct page.
> + * struct page. If the caller expects **pages to be
> + * filled in, bail out now, because that can't be done
> + * for this page.
> */
> + if (pages) {
> + ret = PTR_ERR(page);
> + goto out;
> + }
> +
> goto next_page;
> } else if (IS_ERR(page)) {
> ret = PTR_ERR(page);
It is what I had in mind, I certainly wouldn't add a new condition
that returns 0..
Jason
prev parent reply other threads:[~2022-02-04 1:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-03 6:27 Weird code with change "mm/gup: clean up follow_pfn_pte() slightly" Lukas Bulwahn
2022-02-03 8:38 ` John Hubbard
2022-02-03 13:01 ` Jason Gunthorpe
2022-02-03 20:44 ` John Hubbard
2022-02-04 0:45 ` Jason Gunthorpe
2022-02-04 0:59 ` John Hubbard
2022-02-04 1:06 ` Jason Gunthorpe
2022-02-04 1:22 ` John Hubbard
2022-02-04 1:26 ` Jason Gunthorpe [this message]
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=20220204012607.GQ1786498@nvidia.com \
--to=jgg@nvidia.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alex.williamson@redhat.com \
--cc=david@redhat.com \
--cc=jack@suse.cz \
--cc=jhubbard@nvidia.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lukas.bulwahn@gmail.com \
--cc=peterx@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.