The patch titled Subject: mm: cma: use pageblock_order as the single alignment has been added to the -mm tree. Its filename is mm-cma-use-pageblock_order-as-the-single-alignment.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-cma-use-pageblock_order-as-the-single-alignment.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-cma-use-pageblock_order-as-the-single-alignment.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Zi Yan <ziy@xxxxxxxxxx> Subject: mm: cma: use pageblock_order as the single alignment Now alloc_contig_range() works at pageblock granularity. Change CMA allocation, which uses alloc_contig_range(), to use pageblock_nr_pages alignment. Link: https://lkml.kernel.org/r/20220425143118.2850746-6-zi.yan@xxxxxxxx Signed-off-by: Zi Yan <ziy@xxxxxxxxxx> Cc: Christophe Leroy <christophe.leroy@xxxxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: Eric Ren <renzhengeek@xxxxxxxxx> Cc: kernel test robot <lkp@xxxxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> Cc: Mike Rapoport <rppt@xxxxxxxxxxxxx> Cc: Minchan Kim <minchan@xxxxxxxxxx> Cc: Oscar Salvador <osalvador@xxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/cma.h | 4 ++-- include/linux/mmzone.h | 5 +---- mm/page_alloc.c | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) --- a/include/linux/cma.h~mm-cma-use-pageblock_order-as-the-single-alignment +++ a/include/linux/cma.h @@ -17,11 +17,11 @@ #define CMA_MAX_NAME 64 /* - * TODO: once the buddy -- especially pageblock merging and alloc_contig_range() + * the buddy -- especially pageblock merging and alloc_contig_range() * -- can deal with only some pageblocks of a higher-order page being * MIGRATE_CMA, we can use pageblock_nr_pages. */ -#define CMA_MIN_ALIGNMENT_PAGES MAX_ORDER_NR_PAGES +#define CMA_MIN_ALIGNMENT_PAGES pageblock_nr_pages #define CMA_MIN_ALIGNMENT_BYTES (PAGE_SIZE * CMA_MIN_ALIGNMENT_PAGES) struct cma; --- a/include/linux/mmzone.h~mm-cma-use-pageblock_order-as-the-single-alignment +++ a/include/linux/mmzone.h @@ -54,10 +54,7 @@ enum migratetype { * * The way to use it is to change migratetype of a range of * pageblocks to MIGRATE_CMA which can be done by - * __free_pageblock_cma() function. What is important though - * is that a range of pageblocks must be aligned to - * MAX_ORDER_NR_PAGES should biggest page be bigger than - * a single pageblock. + * __free_pageblock_cma() function. */ MIGRATE_CMA, #endif --- a/mm/page_alloc.c~mm-cma-use-pageblock_order-as-the-single-alignment +++ a/mm/page_alloc.c @@ -9014,8 +9014,8 @@ int __alloc_contig_migrate_range(struct * be either of the two. * @gfp_mask: GFP mask to use during compaction * - * The PFN range does not have to be pageblock or MAX_ORDER_NR_PAGES - * aligned. The PFN range must belong to a single zone. + * The PFN range does not have to be pageblock aligned. The PFN range must + * belong to a single zone. * * The first thing this routine does is attempt to MIGRATE_ISOLATE all * pageblocks in the range. Once isolated, the pageblocks should not _ Patches currently in -mm which might be from ziy@xxxxxxxxxx are mm-page_alloc-simplify-pageblock-migratetype-check-in-__free_one_page.patch mm-wrap-__find_buddy_pfn-with-a-necessary-buddy-page-validation.patch mm-wrap-__find_buddy_pfn-with-a-necessary-buddy-page-validation-v4.patch mm-page_isolation-move-has_unmovable_pages-to-mm-page_isolationc.patch mm-page_isolation-check-specified-range-for-unmovable-pages.patch mm-make-alloc_contig_range-work-at-pageblock-granularity.patch mm-page_isolation-enable-arbitrary-range-page-isolation.patch mm-cma-use-pageblock_order-as-the-single-alignment.patch drivers-virtio_mem-use-pageblock-size-as-the-minimum-virtio_mem-size.patch