page_alloc: allow migration of smaller hugepages during contig_alloc.
Subsystems (2)
PATCH v3 1/1 page_alloc: allow migration of smaller hugepages during contig_alloc.
We presently skip regions with hugepages entirely when trying to do contiguous page allocation. Instead, if hugepage migration is enabled, consider regions with hugepages smaller than the target contiguous allocation request as valid targets for allocation.
isolate_migrate_pages_block() already expects requests with hugepages to originate from alloc_contig, and hugetlb code also does a migratable check when isolating in folio_isolate_hugetlb().
--- mm/page_alloc.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
mm/page_alloc.c +13 -2
@@ -7048,8 +7048,19 @@ static bool pfn_range_valid_contig(struct zone *z, unsigned long start_pfn,if (PageReserved (page))return false; -if (PageHuge (page)) -return false; +if (PageHuge (page)) { +unsigned int order; + +if (!IS_ENABLED (CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION )) +return false; + +/* Don't consider moving same size/larger pages */ + page =compound_head (page); + order =compound_order (page); +if ((order >=MAX_FOLIO_ORDER ) || + (nr_pages <= (1 << order))) +return false; + } }return true; }
Signature · 1 line
2.51.0
Quoted 5 lines · Gregory Price
We presently skip regions with hugepages entirely when trying to do contiguous page allocation. Instead, if hugepage migration is enabled, consider regions with hugepages smaller than the target contiguous allocation request as valid targets for allocation.
Quoted 8 lines
isolate_migrate_pages_block()already expects requests with hugepages to originate fromalloc_contig, and hugetlb code also does a migratable check when isolating infolio_isolate_hugetlb().Suggested-by David Hildenbrand <[email protected]>Signed-off-by Gregory Price <[email protected]>Reviewed-by Zi Yan <[email protected]>Reviewed-by Wei Yang <[email protected]>
Quoted 5 lines · Gregory Price
We presently skip regions with hugepages entirely when trying to do contiguous page allocation. Instead, if hugepage migration is enabled, consider regions with hugepages smaller than the target contiguous allocation request as valid targets for allocation.
Quoted 8 lines
isolate_migrate_pages_block()already expects requests with hugepages to originate fromalloc_contig, and hugetlb code also does a migratable check when isolating infolio_isolate_hugetlb().Suggested-by David Hildenbrand <[email protected]>Signed-off-by Gregory Price <[email protected]>Reviewed-by Zi Yan <[email protected]>Reviewed-by Wei Yang <[email protected]>
Signature · 2 lines
Oscar Salvador SUSE Labs
Quoted 9 lines · Gregory Price
We presently skip regions with hugepages entirely when trying to do contiguous page allocation. Instead, if hugepage migration is enabled, consider regions with hugepages smaller than the target contiguous allocation request as valid targets for allocation.
isolate_migrate_pages_block()already expects requests with hugepages to originate fromalloc_contig, and hugetlb code also does a migratable check when isolating infolio_isolate_hugetlb().
Quoted 5 lines
Suggested-by David Hildenbrand <[email protected]>Signed-off-by Gregory Price <[email protected]>Reviewed-by Zi Yan <[email protected]>Reviewed-by Wei Yang <[email protected]>---
Nit: trailing "." in subject
Signature · 3 lines
Cheers David / dhildenb
Quoted 16 lines · David Hildenbrand
Quoted 9 lines · Gregory Price
We presently skip regions with hugepages entirely when trying to do contiguous page allocation. Instead, if hugepage migration is enabled, consider regions with hugepages smaller than the target contiguous allocation request as valid targets for allocation.
isolate_migrate_pages_block()already expects requests with hugepages to originate fromalloc_contig, and hugetlb code also does a migratable check when isolating infolio_isolate_hugetlb().Quoted 5 lines
Suggested-by David Hildenbrand <[email protected]>Signed-off-by Gregory Price <[email protected]>Reviewed-by Zi Yan <[email protected]>Reviewed-by Wei Yang <[email protected]>---
Quoted 4 lines
Nit: trailing "." in subject
Hi David,
Do you think i should just staple these commits together at this point?
https://lore.kernel.org/linux-mm/[email protected]/
If not i'll drop the '.' and just resubmit this with tags and just update the commit message on movable_gigantic_pages to reference this commit and your notes from there.
~Gregory