On 2/20/21 1:24 AM, Dan Williams wrote: > On Tue, Dec 8, 2020 at 9:32 AM Joao Martins <joao.m.martins@xxxxxxxxxx> wrote: >> >> 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 <joao.m.martins@xxxxxxxxxx> >> --- >> 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. > Ack, I suppose I could just use pgmap @align attribute as you mentioned. Joao