| From: |
| Kefeng Wang <wangkefeng.wang-AT-huawei.com> |
| To: |
| Andrew Morton <akpm-AT-linux-foundation.org>, David Hildenbrand <david-AT-redhat.com>, Oscar Salvador <osalvador-AT-suse.de>, Muchun Song <muchun.song-AT-linux.dev>, <linux-mm-AT-kvack.org> |
| Subject: |
| [PATCH v4 0/6] mm: hugetlb: allocate frozen gigantic folio |
| Date: |
| Thu, 23 Oct 2025 19:59:34 +0800 |
| Message-ID: |
| <20251023115940.3573158-1-wangkefeng.wang@huawei.com> |
| Cc: |
| <sidhartha.kumar-AT-oracle.com>, <jane.chu-AT-oracle.com>, Zi Yan <ziy-AT-nvidia.com>, Vlastimil Babka <vbabka-AT-suse.cz>, Brendan Jackman <jackmanb-AT-google.com>, Johannes Weiner <hannes-AT-cmpxchg.org>, Matthew Wilcox <willy-AT-infradead.org>, Kefeng Wang <wangkefeng.wang-AT-huawei.com> |
| Archive-link: |
| Article |
Introduce alloc_contig_frozen_pages() and cma_alloc_frozen_compound()
which avoid atomic operation about page refcount, and then convert to
allocate frozen gigantic folio by the new helpers in hugetlb to cleanup
the alloc_gigantic_folio().
v4:
- add VM_WARN_ON_PAGE and instead of VM_BUG_ON_PAGE in __split_page()
- add back debug infos in __cma_release()
- rename alloc_contig_range_frozen to alloc_contig_frozen_range, and
make alloc_contig_{range,pages} to only allocate non-compound pages,
the free_contig_range() adjusted accordingly
- add set_pages_refcounted helper to reduce code duplication
- collect ACK
v3:
- Fix built warn/err, found by lkp test
- Address some David's comments,
- Force on frozen part and drop the optimization part
- Rename split_non_compound_pages() to __split_pages()
- Adding back debug print/WARN_ON if no cma range found or the
pfn range of page is not full match the cma range.
v2:
- Optimize gigantic folio allocation speed
- Using HPAGE_PUD_ORDER in debug_vm_pgtable
- Address some David's comments,
- kill folio_alloc_gigantic()
- add generic cma_alloc_frozen{_compound}() instead of
cma_{alloc,free}_folio
Kefeng Wang (6):
mm: debug_vm_pgtable: add debug_vm_pgtable_free_huge_page()
mm: page_alloc: add __split_page()
mm: cma: add __cma_release()
mm: page_alloc: add alloc_contig_frozen_{range,pages}()
mm: cma: add cma_alloc_frozen{_compound}()
mm: hugetlb: allocate frozen pages in alloc_gigantic_folio()
include/linux/cma.h | 27 ++----
include/linux/gfp.h | 52 +++++-----
include/linux/mmdebug.h | 9 ++
mm/cma.c | 107 ++++++++++-----------
mm/debug_vm_pgtable.c | 38 ++++----
mm/hugetlb.c | 58 +++---------
mm/hugetlb_cma.c | 29 +++---
mm/hugetlb_cma.h | 10 +-
mm/internal.h | 11 +++
mm/page_alloc.c | 204 ++++++++++++++++++++++++++++------------
10 files changed, 293 insertions(+), 252 deletions(-)
--
2.27.0