Re: [PATCH v6 04/10] mm/memremap: add ZONE_DEVICE support for compound pages

2021-11-24 Thread Christoph Hellwig
On Wed, Nov 24, 2021 at 07:09:59PM +, Joao Martins wrote: > 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 t

Re: [PATCH v6 00/10] mm, device-dax: Introduce compound pages in devmap

2021-11-24 Thread Andrew Morton
On Wed, 24 Nov 2021 14:30:56 -0800 Dan Williams wrote: > It might end up colliding with some of the DAX cleanups that are > brewing, but if that happens I might apply them to resolve conflicts > and ask Andrew to drop them out of -mm. We can cross that bridge > later. Yep, not a problem.

Re: [PATCH v6 00/10] mm, device-dax: Introduce compound pages in devmap

2021-11-24 Thread Dan Williams
On Wed, Nov 24, 2021 at 11:10 AM Joao Martins wrote: > > Changes since v5[9]: > > * Keep @dev on the previous line to improve readability on > patch 5 (Christoph Hellwig) > * Document is_static() function to clarify what are static and > dynamic dax regions in patch 7 (Christoph Hellwig) > * Deduc

[PATCH v6 10/10] device-dax: compound devmap support

2021-11-24 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 v6 09/10] device-dax: set mapping prior to vmf_insert_pfn{,_pmd,pud}()

2021-11-24 Thread Joao Martins
Normally, the @page mapping is set prior to inserting the page into a page table entry. Make device-dax adhere to the same ordering, rather than setting mapping after the PTE is inserted. The address_space never changes and it is always associated with the same inode and underlying pages. So, the

[PATCH v6 06/10] device-dax: use struct_size()

2021-11-24 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 v6 08/10] device-dax: factor out page mapping initialization

2021-11-24 Thread Joao Martins
Move initialization of page->mapping into a separate helper. This is in preparation to move the mapping set to be prior to inserting the page table entry and also for tidying up compound page handling into one helper. Signed-off-by: Joao Martins --- drivers/dax/device.c | 45 +++

[PATCH v6 07/10] device-dax: ensure dev_dax->pgmap is valid for dynamic devices

2021-11-24 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 v6 05/10] device-dax: use ALIGN() for determining pgoff

2021-11-24 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 v6 03/10] mm/page_alloc: refactor memmap_init_zone_device() page init

2021-11-24 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

[PATCH v6 00/10] mm, device-dax: Introduce compound pages in devmap

2021-11-24 Thread Joao Martins
), it is a known issue that this commit broke efi_fake_mem=. Patches apply on top of linux-next tag next-20211124 (commit 4b74e088fef6). Thanks for all the review so far. As always, Comments and suggestions very much appreciated! Older Changelog, v4[4] -> v5[9]: * Remove patches 8-14 as they w

[PATCH v6 04/10] mm/memremap: add ZONE_DEVICE support for compound pages

2021-11-24 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 v6 02/10] mm/page_alloc: split prep_compound_page into head and tail subparts

2021-11-24 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 v6 01/10] memory-failure: fetch compound_head after pgmap_pfn_valid()

2021-11-24 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