From: Martin Oliveira <martin.oliveira@eideticom.com>
To: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Cc: Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Tejun Heo <tj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Logan Gunthorpe <logang@deltatee.com>,
Martin Oliveira <martin.oliveira@eideticom.com>,
Mike Marciniszyn <mike.marciniszyn@intel.com>,
Shiraz Saleem <shiraz.saleem@intel.com>,
Michael Guralnik <michaelgur@nvidia.com>,
Artemy Kovalyov <artemyko@nvidia.com>
Subject: [PATCH v2 2/4] mm/gup: handle ZONE_DEVICE pages in folio_fast_pin_allowed()
Date: Tue, 11 Jun 2024 12:27:30 -0600 [thread overview]
Message-ID: <20240611182732.360317-3-martin.oliveira@eideticom.com> (raw)
In-Reply-To: <20240611182732.360317-1-martin.oliveira@eideticom.com>
folio_fast_pin_allowed() does not support ZONE_DEVICE pages because
currently it is impossible for that type of page to be used with
FOLL_LONGTERM. When this changes in a subsequent patch, this path will
attempt to read the mapping of a ZONE_DEVICE page which is not valid.
Instead, allow ZONE_DEVICE pages explicitly seeing they shouldn't pose
any problem with the fast path.
Co-developed-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Martin Oliveira <martin.oliveira@eideticom.com>
---
mm/gup.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/gup.c b/mm/gup.c
index ca0f5cedce9b2..00d0a77112f4f 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -2847,6 +2847,10 @@ static bool gup_fast_folio_allowed(struct folio *folio, unsigned int flags)
if (folio_test_hugetlb(folio))
return true;
+ /* It makes no sense to access the mapping of ZONE_DEVICE pages */
+ if (folio_is_zone_device(folio))
+ return true;
+
/*
* GUP-fast disables IRQs. When IRQS are disabled, RCU grace periods
* cannot proceed, which means no actions performed under RCU can
--
2.43.0
next prev parent reply other threads:[~2024-06-11 18:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-11 18:27 [PATCH v2 0/4] Enable P2PDMA in Userspace RDMA Martin Oliveira
2024-06-11 18:27 ` [PATCH v2 1/4] kernfs: remove page_mkwrite() from vm_operations_struct Martin Oliveira
2024-06-12 8:09 ` Greg Kroah-Hartman
2024-06-12 17:29 ` Tejun Heo
2024-06-13 5:15 ` Dan Carpenter
2024-06-13 5:44 ` Christoph Hellwig
2024-06-15 2:32 ` John Hubbard
2024-06-11 18:27 ` Martin Oliveira [this message]
2024-06-15 2:40 ` [PATCH v2 2/4] mm/gup: handle ZONE_DEVICE pages in folio_fast_pin_allowed() John Hubbard
2024-06-26 22:23 ` Martin Oliveira
2024-06-11 18:27 ` [PATCH v2 3/4] mm/gup: allow FOLL_LONGTERM & FOLL_PCI_P2PDMA Martin Oliveira
2024-06-15 2:45 ` John Hubbard
2024-06-11 18:27 ` [PATCH v2 4/4] RDMA/umem: add support for P2P RDMA Martin Oliveira
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=20240611182732.360317-3-martin.oliveira@eideticom.com \
--to=martin.oliveira@eideticom.com \
--cc=akpm@linux-foundation.org \
--cc=artemyko@nvidia.com \
--cc=gregkh@linuxfoundation.org \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rdma@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=michaelgur@nvidia.com \
--cc=mike.marciniszyn@intel.com \
--cc=shiraz.saleem@intel.com \
--cc=tj@kernel.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