Re: [PATCH RFC 1/9] memremap: add ZONE_DEVICE support for compound pages
From: Dan Williams <hidden>
Date: 2021-02-20 01:24:21
Also in:
nvdimm
On Tue, Dec 8, 2020 at 9:32 AM Joao Martins [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Add a new flag for struct dev_pagemap which designates that a a pagemap is described as a set of compound pages or in other words, that how pages are grouped together in the page tables are reflected in how we describe struct pages. This means that rather than initializing individual struct pages, we also initialize these struct pages, as compound pages (on x86: 2M or 1G compound pages) For certain ZONE_DEVICE users, like device-dax, which have a fixed page size, this creates an opportunity to optimize GUP and GUP-fast walkers, thus playing the same tricks as hugetlb pages. Signed-off-by: Joao Martins <redacted> --- include/linux/memremap.h | 2 ++ mm/memremap.c | 8 ++++++-- mm/page_alloc.c | 7 +++++++ 3 files changed, 15 insertions(+), 2 deletions(-)diff --git a/include/linux/memremap.h b/include/linux/memremap.h index 79c49e7f5c30..f8f26b2cc3da 100644 --- a/include/linux/memremap.h +++ b/include/linux/memremap.h@@ -90,6 +90,7 @@ struct dev_pagemap_ops { }; #define PGMAP_ALTMAP_VALID (1 << 0) +#define PGMAP_COMPOUND (1 << 1)
Why is a new flag needed versus just the align attribute? In other words there should be no need to go back to the old/slow days of 'struct page' per pfn after compound support is added.