Re: [PATCH v5 0/8] mm, dax: Introduce compound pages in devmap

2021-11-12 Thread Jason Gunthorpe
On Fri, Nov 12, 2021 at 04:08:16PM +0100, Joao Martins wrote: > This series converts device-dax to use compound pages, and moves away from the > 'struct page per basepage on PMD/PUD' that is done today. Doing so, unlocks a > few noticeable improvements on unpin_user_pages() and makes device-dax+al

Re: [PATCH v5 8/8] device-dax: compound devmap support

2021-11-12 Thread Jason Gunthorpe
On Fri, Nov 12, 2021 at 04:08:24PM +0100, Joao Martins wrote: > diff --git a/drivers/dax/device.c b/drivers/dax/device.c > index a65c67ab5ee0..0c2ac97d397d 100644 > +++ b/drivers/dax/device.c > @@ -192,6 +192,42 @@ static vm_fault_t __dev_dax_pud_fault(struct dev_dax > *dev_dax, > } > #endif /*

[PATCH v5 8/8] device-dax: compound devmap support

2021-11-12 Thread Joao Martins
Use the newly added compound devmap facility which maps the assigned dax ranges as compound pages at a page size of @align. dax devices are created with a fixed @align (huge page size) which is enforced through as well at mmap() of the device. Faults, consequently happen too at the specified @alig

[PATCH v5 7/8] device-dax: ensure dev_dax->pgmap is valid for dynamic devices

2021-11-12 Thread Joao Martins
Right now, only static dax regions have a valid @pgmap pointer in its struct dev_dax. Dynamic dax case however, do not. In preparation for device-dax compound devmap support, make sure that dev_dax pgmap field is set after it has been allocated and initialized. dynamic dax device have the @pgmap

[PATCH v5 5/8] device-dax: use ALIGN() for determining pgoff

2021-11-12 Thread Joao Martins
Rather than calculating @pgoff manually, switch to ALIGN() instead. Suggested-by: Dan Williams Signed-off-by: Joao Martins Reviewed-by: Dan Williams --- drivers/dax/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dax/device.c b/drivers/dax/device.c inde

[PATCH v5 6/8] device-dax: use struct_size()

2021-11-12 Thread Joao Martins
Use the struct_size() helper for the size of a struct with variable array member at the end, rather than manually calculating it. Suggested-by: Dan Williams Signed-off-by: Joao Martins --- drivers/dax/device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/dax/

[PATCH v5 0/8] mm, dax: Introduce compound pages in devmap

2021-11-12 Thread Joao Martins
tup: Call early_reserve_memory() earlier"), it is a known issue that this commit broke efi_fake_mem=. Patches apply on top of linux-next tag next-2022 (commit f2e19fd15bd7). Thanks for all the review. Comments and suggestions very much appreciated! Older Changelog, v3[3] -> v4[4]: *

[PATCH v5 4/8] mm/memremap: add ZONE_DEVICE support for compound pages

2021-11-12 Thread Joao Martins
Add a new @vmemmap_shift property for struct dev_pagemap which specifies that a devmap is composed of a set of compound pages of order @vmemmap_shift, instead of base pages. When a compound page devmap is requested, all but the first page are initialised as tail pages instead of order-0 pages. Fo

[PATCH v5 1/8] memory-failure: fetch compound_head after pgmap_pfn_valid()

2021-11-12 Thread Joao Martins
memory_failure_dev_pagemap() at the moment assumes base pages (e.g. dax_lock_page()). For devmap with compound pages fetch the compound_head in case a tail page memory failure is being handled. Currently this is a nop, but in the advent of compound pages in dev_pagemap it allows memory_failure_de

[PATCH v5 2/8] mm/page_alloc: split prep_compound_page into head and tail subparts

2021-11-12 Thread Joao Martins
Split the utility function prep_compound_page() into head and tail counterparts, and use them accordingly. This is in preparation for sharing the storage for compound page metadata. Signed-off-by: Joao Martins Acked-by: Mike Kravetz Reviewed-by: Dan Williams Reviewed-by: Muchun Song --- mm/p

[PATCH v5 3/8] mm/page_alloc: refactor memmap_init_zone_device() page init

2021-11-12 Thread Joao Martins
Move struct page init to an helper function __init_zone_device_page(). This is in preparation for sharing the storage for compound page metadata. Signed-off-by: Joao Martins Reviewed-by: Dan Williams --- mm/page_alloc.c | 74 +++-- 1 file changed, 41