mm-contig_alloc-support-__gfp_comp.patch removed from -mm tree
The quilt patch titled
Subject: mm/contig_alloc: support __GFP_COMP
has been removed from the -mm tree. Its filename was
mm-contig_alloc-support-__gfp_comp.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Yu Zhao <[email protected]>
Subject: mm/contig_alloc: support __GFP_COMP
Date: Tue, 13 Aug 2024 21:54:49 -0600
Patch series "mm/hugetlb: alloc/free gigantic folios", v2.
Use __GFP_COMP for gigantic folios can greatly reduce not only the amount of code but also the allocation and free time.
Approximate LOC to mm/hugetlb.c: +60, -240
Allocate and free 500 1GB hugeTLB memory without HVO by:
time echo 500 >/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages time echo 0 >/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages
Before After Alloc ~13s ~10s Free ~15s <1s
The above magnitude generally holds for multiple x86 and arm64 CPU models.
Perf profile before:
Alloc
- 99.99% alloc_pool_huge_folio
- __alloc_fresh_hugetlb_folio
- 83.23% alloc_contig_pages_noprof
- 47.46% alloc_contig_range_noprof
- 20.96% isolate_freepages_range
16.10% split_page
- 14.10% start_isolate_page_range
- 12.02% undo_isolate_page_range
Free
- update_and_free_pages_bulk
- 87.71% free_contig_range
- 76.02% free_unref_page
- 41.30% free_unref_page_commit
- 32.58% free_pcppages_bulk
- 24.75% __free_one_page
13.96% _raw_spin_trylock
12.27% __update_and_free_hugetlb_folio
Perf profile after:
Alloc
- 99.99% alloc_pool_huge_folio
alloc_gigantic_folio
- alloc_contig_pages_noprof
- 59.15% alloc_contig_range_noprof
- 20.72% start_isolate_page_range
20.64% prep_new_page
- 17.13% undo_isolate_page_range
Free
- update_and_free_pages_bulk
- __folio_put
- __free_pages_ok
7.46% free_tail_page_prepare
- 1.97% free_one_page
1.86% __free_one_page
This patch (of 3):
Support __GFP_COMP in alloc_contig_range(). When the flag is set, upon success the function returns a large folio prepared by prep_new_page(), rather than a range of order-0 pages prepared by split_free_pages() (which is renamed from split_map_pages()).
alloc_contig_range() can be used to allocate folios larger than MAX_PAGE_ORDER, e.g., gigantic hugeTLB folios. So on the free path, free_one_page() needs to handle that by split_large_buddy().
---
include/linux/gfp.h | 23 ++++++++ mm/compaction.c | 41 +-------------- mm/page_alloc.c | 111 ++++++++++++++++++++++++++++++------------ 3 files changed, 108 insertions(+), 67 deletions(-)
include/linux/gfp.h renamed from include/linux/gfp.h~mm-contig_alloc-support-__gfp_comp +23 -0
@@ -446,4 +446,27 @@ extern struct page *alloc_contig_pages_n#endif void free_contig_range (unsigned long pfn,unsigned long nr_pages); +#ifdef CONFIG_CONTIG_ALLOC +static inline struct folio *folio_alloc_gigantic_noprof (int order,gfp_t gfp, +int nid,nodemask_t *node) +{ +struct page *page; + +if (WARN_ON (!order || !(gfp & __GFP_COMP))) +return NULL ; + + page =alloc_contig_pages_noprof (1 << order, gfp, nid, node); + +return page ?page_folio (page) :NULL ; +} +#else +static inline struct folio *folio_alloc_gigantic_noprof (int order,gfp_t gfp, +int nid,nodemask_t *node) +{ +return NULL ; +} +#endif +/* This should be paired with folio_put() rather than free_contig_range(). */ +#define folio_alloc_gigantic (...) alloc_hooks(folio_alloc_gigantic_noprof(__VA_ARGS__)) +#endif /* __LINUX_GFP_H */
mm/compaction.c renamed from mm/compaction.c~mm-contig_alloc-support-__gfp_comp +5 -36
79 lines not on this page · raw message
mm/page_alloc.c renamed from mm/page_alloc.c~mm-contig_alloc-support-__gfp_comp +80 -31
161 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are
mm-free-zapped-tail-pages-when-splitting-isolated-thp.patch mm-remap-unused-subpages-to-shared-zeropage-when-splitting-isolated-thp.patch