lkml.org 
[lkml]   [2022]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH mm-unstable] mm: clarify folio_set_compound_order() zero support
From
On 12/7/22 14:37, Sidhartha Kumar wrote:
> Document hugetlb's use of a zero compound order so support for zero
> orders is not removed from folio_set_compound_order().
>
> Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
> Suggested-by: Mike Kravetz <mike.kravetz@oracle.com>
> Suggested-by: Muchun Song <songmuchun@bytedance.com>
> ---
> This can be folded into f2b67a51d0ef6871d4fb0c3e8199f278112bd108
> mm: add folio dtor and order setter functions
>
> include/linux/mm.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 443d496949a8..cd8508d728f1 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -999,9 +999,16 @@ static inline void set_compound_order(struct page *page, unsigned int order)
> #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.
> + */

Wouldn't it be better to instead just create a new function for that
case, such as:

dissolve_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;

thanks,
--
John Hubbard
NVIDIA

\
 
 \ /
  Last update: 2022-12-08 01:39    [W:0.233 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site