[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <25BBA6FE-5134-4CF8-B0B2-BF3BE907AC38@amd.com>
Date: Mon, 19 Jul 2021 20:47:04 +0000
From: "Zeng, Oak" <Oak.Zeng@....com>
To: "Sierra Guiza, Alejandro (Alex)" <Alex.Sierra@....com>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"Kuehling, Felix" <Felix.Kuehling@....com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"rcampbell@...dia.com" <rcampbell@...dia.com>,
"linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>,
"linux-xfs@...r.kernel.org" <linux-xfs@...r.kernel.org>
CC: "jglisse@...hat.com" <jglisse@...hat.com>,
"jgg@...dia.com" <jgg@...dia.com>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"amd-gfx@...ts.freedesktop.org" <amd-gfx@...ts.freedesktop.org>,
"hch@....de" <hch@....de>
Subject: Re: [PATCH v4 06/13] include/linux/mm.h: helpers to check zone device
generic type
Regards,
Oak
On 2021-07-17, 3:22 PM, "amd-gfx on behalf of Alex Sierra" <amd-gfx-bounces@...ts.freedesktop.org on behalf of Alex.Sierra@....com> wrote:
Two helpers added. One checks if zone device page is generic
type. The other if page is either private or generic type.
Signed-off-by: Alex Sierra <alex.sierra@....com>
---
include/linux/mm.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index d8d79bb94be8..f5b247a63044 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1125,6 +1125,14 @@ static inline bool is_device_private_page(const struct page *page)
page->pgmap->type == MEMORY_DEVICE_PRIVATE;
}
+static inline bool is_device_page(const struct page *page)
The function name here is confusing. Theoretically as long as page's zone number is ZONE_DEVICE, then the page is a device page. You put the condition more strict below just because the kfd svm implementation only uses MEMORY_DEVICE_PRIVATE/GENERIC. But MEMORY_DEVICE_FS_DAX and MEMORY_DEVICE_PCI_P2PDMA is also device memory (compared to normal cpu system memory).
+{
+ return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) &&
+ is_zone_device_page(page) &&
+ (page->pgmap->type == MEMORY_DEVICE_PRIVATE ||
+ page->pgmap->type == MEMORY_DEVICE_GENERIC);
+}
+
static inline bool is_pci_p2pdma_page(const struct page *page)
{
return IS_ENABLED(CONFIG_DEV_PAGEMAP_OPS) &&
--
2.32.0
_______________________________________________
amd-gfx mailing list
amd-gfx@...ts.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Coak.zeng%40amd.com%7C6a01845fd1524360d79a08d949583365%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637621465431851292%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=nHblZdGYyYuQVws%2BgG4HgnKpGiQXCfxxEnWZuozKy9g%3D&reserved=0
Powered by blists - more mailing lists