[PATCH v4 06/13] include/linux/mm.h: helpers to check zone device generic type

Zeng, Oak Oak.Zeng at amd.com
Mon Jul 19 20:47:04 UTC 2021



On 2021-07-17, 3:22 PM, "amd-gfx on behalf of Alex Sierra" <amd-gfx-bounces at lists.freedesktop.org on behalf of Alex.Sierra at amd.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 at amd.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).

    +		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)

    amd-gfx mailing list
    amd-gfx at lists.freedesktop.org

More information about the amd-gfx mailing list