From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org, peterx@redhat.com,
kirill.shutemov@linux.intel.com, jgg@ziepe.ca, jgg@nvidia.com,
jack@suse.cz, david@redhat.com, alex.williamson@redhat.com,
aarcange@redhat.com, jhubbard@nvidia.com,
akpm@linux-foundation.org
Subject: + mm-gup-clean-up-follow_pfn_pte-slightly.patch added to -mm tree
Date: Tue, 01 Feb 2022 12:58:17 -0800 [thread overview]
Message-ID: <20220201205817.CFCA4C340EC@smtp.kernel.org> (raw)
The patch titled
Subject: mm/gup: clean up follow_pfn_pte() slightly
has been added to the -mm tree. Its filename is
mm-gup-clean-up-follow_pfn_pte-slightly.patch
This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/mm-gup-clean-up-follow_pfn_pte-slightly.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/mm-gup-clean-up-follow_pfn_pte-slightly.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: John Hubbard <jhubbard@nvidia.com>
Subject: mm/gup: clean up follow_pfn_pte() slightly
Regardless of any FOLL_* flags, get_user_pages() and its variants should
handle PFN-only entries by stopping early, if the caller expected **pages
to be filled in.
This makes for a more reliable API, as compared to the previous approach
of skipping over such entries (and thus leaving them silently unwritten).
Link: https://lkml.kernel.org/r/20220201101108.306062-3-jhubbard@nvidia.com
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/gup.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
--- a/mm/gup.c~mm-gup-clean-up-follow_pfn_pte-slightly
+++ a/mm/gup.c
@@ -439,10 +439,6 @@ static struct page *no_page_table(struct
static int follow_pfn_pte(struct vm_area_struct *vma, unsigned long address,
pte_t *pte, unsigned int flags)
{
- /* No page to get reference */
- if (flags & (FOLL_GET | FOLL_PIN))
- return -EFAULT;
-
if (flags & FOLL_TOUCH) {
pte_t entry = *pte;
@@ -1180,8 +1176,14 @@ retry:
} 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) {
+ page = ERR_PTR(-EFAULT);
+ goto out;
+ }
goto next_page;
} else if (IS_ERR(page)) {
ret = PTR_ERR(page);
_
Patches currently in -mm which might be from jhubbard@nvidia.com are
mm-gup-clean-up-follow_pfn_pte-slightly.patch
mm-gup-remove-unused-pin_user_pages_locked.patch
mm-gup-remove-get_user_pages_locked.patch
reply other threads:[~2022-02-01 20:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220201205817.CFCA4C340EC@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=aarcange@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=david@redhat.com \
--cc=jack@suse.cz \
--cc=jgg@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=jhubbard@nvidia.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mm-commits@vger.kernel.org \
--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.