Re: [PATCH v5 4/5] mm/sparse-vmemmap: improve memory savings for compound devmaps

2022-02-10 Thread Muchun Song
On Fri, Feb 11, 2022 at 3:34 AM Joao Martins wrote: [...] > pte_t * __meminit vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int > node, > - struct vmem_altmap *altmap) > + struct vmem_altmap *altmap, > +

Re: [PATCH v5 2/5] mm/sparse-vmemmap: refactor core of vmemmap_populate_basepages() to helper

2022-02-10 Thread Muchun Song
On Fri, Feb 11, 2022 at 3:34 AM Joao Martins wrote: > > In preparation for describing a memmap with compound pages, move the > actual pte population logic into a separate function > vmemmap_populate_address() and have vmemmap_populate_basepages() walk > through all base pages it needs to populate.

Re: [PATCH v5 5/5] mm/page_alloc: reuse tail struct pages for compound devmaps

2022-02-10 Thread Muchun Song
On Fri, Feb 11, 2022 at 3:34 AM Joao Martins wrote: > > Currently memmap_init_zone_device() ends up initializing 32768 pages > when it only needs to initialize 128 given tail page reuse. That > number is worse with 1GB compound pages, 262144 instead of 128. Update > memmap_init_zone_device() to sk

[PATCH v5 5/5] mm/page_alloc: reuse tail struct pages for compound devmaps

2022-02-10 Thread Joao Martins
Currently memmap_init_zone_device() ends up initializing 32768 pages when it only needs to initialize 128 given tail page reuse. That number is worse with 1GB compound pages, 262144 instead of 128. Update memmap_init_zone_device() to skip redundant initialization, detailed below. When a pgmap @vme

[PATCH v5 3/5] mm/hugetlb_vmemmap: move comment block to Documentation/vm

2022-02-10 Thread Joao Martins
In preparation for device-dax for using hugetlbfs compound page tail deduplication technique, move the comment block explanation into a common place in Documentation/vm. Cc: Muchun Song Cc: Mike Kravetz Suggested-by: Dan Williams Signed-off-by: Joao Martins Reviewed-by: Muchun Song Reviewed-b

[PATCH v5 4/5] mm/sparse-vmemmap: improve memory savings for compound devmaps

2022-02-10 Thread Joao Martins
A compound devmap is a dev_pagemap with @vmemmap_shift > 0 and it means that pages are mapped at a given huge page alignment and utilize uses compound pages as opposed to order-0 pages. Take advantage of the fact that most tail pages look the same (except the first two) to minimize struct page ove

[PATCH v5 2/5] mm/sparse-vmemmap: refactor core of vmemmap_populate_basepages() to helper

2022-02-10 Thread Joao Martins
In preparation for describing a memmap with compound pages, move the actual pte population logic into a separate function vmemmap_populate_address() and have vmemmap_populate_basepages() walk through all base pages it needs to populate. Signed-off-by: Joao Martins --- mm/sparse-vmemmap.c | 51 ++

[PATCH v5 0/5] sparse-vmemmap: memory savings for compound devmaps (device-dax)

2022-02-10 Thread Joao Martins
Changes since v4[0]: * Rebased to next-20220210. * Adjust patch 3, given Muchun changes to the comment block, retained the Rb tags considering it is still just a move of text. * Rename @geometry to @vmemmap_shift in all patches/cover-letter. * Rename pgmap_geometry() calls to pgmap_vmemmap_nr

[PATCH v5 1/5] mm/sparse-vmemmap: add a pgmap argument to section activation

2022-02-10 Thread Joao Martins
In support of using compound pages for devmap mappings, plumb the pgmap down to the vmemmap_populate implementation. Note that while altmap is retrievable from pgmap the memory hotplug code passes altmap without pgmap[*], so both need to be independently plumbed. So in addition to @altmap, pass @p