2024-04-05 12:24:41

by Baolin Wang

[permalink] [raw]
Subject: [PATCH] mm: set pageblock_order to HPAGE_PMD_ORDER in case with !CONFIG_HUGETLB_PAGE but THP enabled

As Vlastimil suggested in previous discussion[1], it doesn't make sense to set
pageblock_order as MAX_PAGE_ORDER when hugetlbfs is not enabled and THP is enabled.
Instead, it should be set to HPAGE_PMD_ORDER.

[1] https://lore.kernel.org/all/[email protected]/
Suggested-by: Vlastimil Babka <[email protected]>
Signed-off-by: Baolin Wang <[email protected]>
---
include/linux/pageblock-flags.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h
index 3f2409b968ec..547e82cdc89a 100644
--- a/include/linux/pageblock-flags.h
+++ b/include/linux/pageblock-flags.h
@@ -28,7 +28,7 @@ enum pageblock_bits {
NR_PAGEBLOCK_BITS
};

-#ifdef CONFIG_HUGETLB_PAGE
+#if defined(CONFIG_HUGETLB_PAGE)

#ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE

@@ -45,7 +45,11 @@ extern unsigned int pageblock_order;

#endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */

-#else /* CONFIG_HUGETLB_PAGE */
+#elif defined(CONFIG_TRANSPARENT_HUGEPAGE)
+
+#define pageblock_order min_t(unsigned int, HPAGE_PMD_ORDER, MAX_PAGE_ORDER)
+
+#else /* CONFIG_TRANSPARENT_HUGEPAGE */

/* If huge pages are not used, group by MAX_ORDER_NR_PAGES */
#define pageblock_order MAX_PAGE_ORDER
--
2.39.3



2024-04-05 14:40:08

by Vlastimil Babka

[permalink] [raw]
Subject: Re: [PATCH] mm: set pageblock_order to HPAGE_PMD_ORDER in case with !CONFIG_HUGETLB_PAGE but THP enabled

On 4/5/24 2:24 PM, Baolin Wang wrote:
> As Vlastimil suggested in previous discussion[1], it doesn't make sense to set
> pageblock_order as MAX_PAGE_ORDER when hugetlbfs is not enabled and THP is enabled.
> Instead, it should be set to HPAGE_PMD_ORDER.
>
> [1] https://lore.kernel.org/all/[email protected]/
> Suggested-by: Vlastimil Babka <[email protected]>
> Signed-off-by: Baolin Wang <[email protected]>

Acked-by: Vlastimil Babka <[email protected]>

Thanks!

> ---
> include/linux/pageblock-flags.h | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h
> index 3f2409b968ec..547e82cdc89a 100644
> --- a/include/linux/pageblock-flags.h
> +++ b/include/linux/pageblock-flags.h
> @@ -28,7 +28,7 @@ enum pageblock_bits {
> NR_PAGEBLOCK_BITS
> };
>
> -#ifdef CONFIG_HUGETLB_PAGE
> +#if defined(CONFIG_HUGETLB_PAGE)
>
> #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE
>
> @@ -45,7 +45,11 @@ extern unsigned int pageblock_order;
>
> #endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
>
> -#else /* CONFIG_HUGETLB_PAGE */
> +#elif defined(CONFIG_TRANSPARENT_HUGEPAGE)
> +
> +#define pageblock_order min_t(unsigned int, HPAGE_PMD_ORDER, MAX_PAGE_ORDER)
> +
> +#else /* CONFIG_TRANSPARENT_HUGEPAGE */
>
> /* If huge pages are not used, group by MAX_ORDER_NR_PAGES */
> #define pageblock_order MAX_PAGE_ORDER


2024-04-05 16:36:32

by Zi Yan

[permalink] [raw]
Subject: Re: [PATCH] mm: set pageblock_order to HPAGE_PMD_ORDER in case with !CONFIG_HUGETLB_PAGE but THP enabled

On 5 Apr 2024, at 8:24, Baolin Wang wrote:

> As Vlastimil suggested in previous discussion[1], it doesn't make sense to set
> pageblock_order as MAX_PAGE_ORDER when hugetlbfs is not enabled and THP is enabled.
> Instead, it should be set to HPAGE_PMD_ORDER.
>
> [1] https://lore.kernel.org/all/[email protected]/
> Suggested-by: Vlastimil Babka <[email protected]>
> Signed-off-by: Baolin Wang <[email protected]>
> ---
> include/linux/pageblock-flags.h | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
LGTM. Reviewed-by: Zi Yan <[email protected]>

--
Best Regards,
Yan, Zi


Attachments:
signature.asc (871.00 B)
OpenPGP digital signature

2024-04-08 18:58:21

by David Hildenbrand

[permalink] [raw]
Subject: Re: [PATCH] mm: set pageblock_order to HPAGE_PMD_ORDER in case with !CONFIG_HUGETLB_PAGE but THP enabled

On 05.04.24 14:24, Baolin Wang wrote:
> As Vlastimil suggested in previous discussion[1], it doesn't make sense to set
> pageblock_order as MAX_PAGE_ORDER when hugetlbfs is not enabled and THP is enabled.
> Instead, it should be set to HPAGE_PMD_ORDER.
>
> [1] https://lore.kernel.org/all/[email protected]/
> Suggested-by: Vlastimil Babka <[email protected]>
> Signed-off-by: Baolin Wang <[email protected]>
> ---
> include/linux/pageblock-flags.h | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h
> index 3f2409b968ec..547e82cdc89a 100644
> --- a/include/linux/pageblock-flags.h
> +++ b/include/linux/pageblock-flags.h
> @@ -28,7 +28,7 @@ enum pageblock_bits {
> NR_PAGEBLOCK_BITS
> };
>
> -#ifdef CONFIG_HUGETLB_PAGE
> +#if defined(CONFIG_HUGETLB_PAGE)
>
> #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE
>
> @@ -45,7 +45,11 @@ extern unsigned int pageblock_order;
>
> #endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
>
> -#else /* CONFIG_HUGETLB_PAGE */
> +#elif defined(CONFIG_TRANSPARENT_HUGEPAGE)
> +
> +#define pageblock_order min_t(unsigned int, HPAGE_PMD_ORDER, MAX_PAGE_ORDER)
> +
> +#else /* CONFIG_TRANSPARENT_HUGEPAGE */
>
> /* If huge pages are not used, group by MAX_ORDER_NR_PAGES */
> #define pageblock_order MAX_PAGE_ORDER


Acked-by: David Hildenbrand <[email protected]>

--
Cheers,

David / dhildenb