[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240605192934.742369-5-martin.oliveira@eideticom.com>
Date: Wed, 5 Jun 2024 13:29:32 -0600
From: Martin Oliveira <martin.oliveira@...eticom.com>
To: linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org,
linux-mm@...ck.org
Cc: Jason Gunthorpe <jgg@...pe.ca>,
Leon Romanovsky <leon@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Logan Gunthorpe <logang@...tatee.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Tejun Heo <tj@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Mike Marciniszyn <mike.marciniszyn@...el.com>,
Michael Guralnik <michaelgur@...dia.com>,
Martin Oliveira <martin.oliveira@...eticom.com>,
Dan Williams <dan.j.williams@...el.com>,
Ard Biesheuvel <ardb@...nel.org>,
Valentine Sinitsyn <valesini@...dex-team.ru>,
Lukas Wunner <lukas@...ner.de>
Subject: [PATCH 4/6] mm/gup: handle ZONE_DEVICE pages in folio_fast_pin_allowed()
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@...tatee.com>
Signed-off-by: Logan Gunthorpe <logang@...tatee.com>
Signed-off-by: Martin Oliveira <martin.oliveira@...eticom.com>
---
mm/gup.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/gup.c b/mm/gup.c
index ca0f5cedce9b..00d0a77112f4 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.34.1
Powered by blists - more mailing lists