The patch titled Subject: mm: clarify folio_set_compound_order() zero support has been added to the -mm mm-unstable branch. Its filename is mm-add-folio-dtor-and-order-setter-functions-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-add-folio-dtor-and-order-setter-functions-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm 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 via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Sidhartha Kumar <sidhartha.kumar@xxxxxxxxxx> Subject: mm: clarify folio_set_compound_order() zero support Date: Wed, 7 Dec 2022 14:37:31 -0800 Document hugetlb's use of a zero compound order so support for zero orders is not removed from folio_set_compound_order(). Link: https://lkml.kernel.org/r/20221207223731.32784-1-sidhartha.kumar@xxxxxxxxxx Signed-off-by: Sidhartha Kumar <sidhartha.kumar@xxxxxxxxxx> Suggested-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Suggested-by: Muchun Song <songmuchun@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/include/linux/mm.h~mm-add-folio-dtor-and-order-setter-functions-fix +++ a/include/linux/mm.h @@ -1019,9 +1019,16 @@ static inline void set_compound_order(st #endif } +/* + * folio_set_compound_order is generally passed a non-zero order to + * initialize a large folio. However, hugetlb code abuses this by + * passing in zero when 'dissolving' a large folio. + */ static inline void folio_set_compound_order(struct folio *folio, unsigned int order) { + VM_BUG_ON_FOLIO(!folio_test_large(folio), folio); + folio->_folio_order = order; #ifdef CONFIG_64BIT folio->_folio_nr_pages = order ? 1U << order : 0; _ Patches currently in -mm which might be from sidhartha.kumar@xxxxxxxxxx are mm-add-folio-dtor-and-order-setter-functions.patch mm-add-folio-dtor-and-order-setter-functions-fix.patch mm-hugetlb-convert-destroy_compound_gigantic_page-to-folios.patch mm-hugetlb-convert-dissolve_free_huge_page-to-folios.patch mm-hugetlb-convert-remove_hugetlb_page-to-folios.patch mm-hugetlb-convert-update_and_free_page-to-folios.patch mm-hugetlb-convert-add_hugetlb_page-to-folios-and-add-hugetlb_cma_folio.patch mm-hugetlb-convert-enqueue_huge_page-to-folios.patch mm-hugetlb-convert-free_gigantic_page-to-folios.patch mm-hugetlb-convert-hugetlb-prep-functions-to-folios.patch mm-hugetlb-change-hugetlb-allocation-functions-to-return-a-folio.patch mm-hugetlb-change-hugetlb-allocation-functions-to-return-a-folio-fix.patch