linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Usama Arif <usamaarif642@gmail.com>
To: Zi Yan <ziy@nvidia.com>, Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: david@redhat.com, Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, hannes@cmpxchg.org, shakeel.butt@linux.dev,
	riel@surriel.com, baolin.wang@linux.alibaba.com,
	Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com,
	dev.jain@arm.com, hughd@google.com, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org, kernel-team@meta.com,
	Juan Yescas <jyescas@google.com>,
	Breno Leitao <leitao@debian.org>
Subject: Re: [RFC] mm: khugepaged: use largest enabled hugepage order for min_free_kbytes
Date: Tue, 10 Jun 2025 16:16:46 +0100	[thread overview]
Message-ID: <7b16ed90-659f-45b4-83e9-62781e5460a6@gmail.com> (raw)
In-Reply-To: <46F6B7C4-542C-4310-9C70-F7469B151C7C@nvidia.com>



On 10/06/2025 15:20, Zi Yan wrote:
> On 10 Jun 2025, at 10:03, Lorenzo Stoakes wrote:
> 
>> On Mon, Jun 09, 2025 at 03:49:52PM -0400, Zi Yan wrote:
>> [snip]
>>>> I really think a hard cap, expressed in KB/MB, on pageblock size is the way to
>>>> go (but overrideable for people crazy enough to truly want 512 MB pages - and
>>>> who cannot then complain about watermarks).
>>>
>>> I agree. Basically, I am thinking:
>>> 1) use something like 2MB as default pageblock size for all arch (the value can
>>> be set differently if some arch wants a different pageblock size due to other reasons), this can be done by modifying PAGE_BLOCK_MAX_ORDER’s default
>>> value;
>>
>> I don't think we can set this using CONFIG_PAGE_BLOCK_MAX_ORDER.
>>
>> Because the 'order' will be a different size depending on page size obviously.
>>
>> So I'm not sure how this would achieve what we want?
>>
>> It seems to me we should have CONFIG_PAGE_BLOCK_MAX_SIZE_MB or something like
>> this, and we take min(page_size << CONFIG_PAGE_BLOCK_MAX_ORDER,
>> CONFIG_PAGE_BLOCK_MAX_SIZE_MB << 20) as the size.
> 
> OK. Now I get what you mean. Yeah, using MB is clearer as user does not
> need to know page size to set the right pageblock size.
> 

Just adding it here for completeness, but we could do something like below probably
or use PAGE_SIZE_64KB instead of ARM64_64K_PAGES.
Although it will be messy, as you would then need to do it for every arch and every
page size of that arch.


diff --git a/mm/Kconfig b/mm/Kconfig
index 99910bc649f6..ae83e31ea412 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -1023,6 +1023,7 @@ config PAGE_BLOCK_MAX_ORDER
        default 10 if ARCH_FORCE_MAX_ORDER = 0
        range 1 ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER != 0
        default ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER != 0
+       default 5 if ARM64_64K_PAGES
        help
          The page block order refers to the power of two number of pages that
          are physically contiguous and can have a migrate type associated to
>>
>>>
>>> 2) make pageblock_order a boot time parameter, so that user who wants
>>> 512MB pages can still get it by changing pageblock order at boot time.
>>>
>>
>> Again, I don't think order is the right choice here, though having it boot time
>> configurable (perhaps overriding the default config there) seems sensible.
> 
> Understood. The new pageblock size should be set using MB.
> 
>>
>>> WDYT?
>>
>>>
>>>>
>>>>>
>>>>> Often, user just ask for an impossible combination: they
>>>>> want to use all free memory, because they paid for it, and they
>>>>> want THPs, because they want max performance. When PMD THP is
>>>>> small like 2MB, the “unusable” free memory is not that noticeable,
>>>>> but when PMD THP is as large as 512MB, user just cannot unsee it. :)
>>>>
>>>> Well, users asking for crazy things then being surprised when they get them
>>>> is nothing new :P
>>>>
>>>>>
>>>>>
>>>>> Best Regards,
>>>>> Yan, Zi
>>>>
>>>> Thanks for your input!
>>>>
>>>> Cheers, Lorenzo
>>>
>>>
>>> Best Regards,
>>> Yan, Zi
> 
> 
> Best Regards,
> Yan, Zi



  reply	other threads:[~2025-06-10 15:16 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-06 14:37 Usama Arif
2025-06-06 15:01 ` Usama Arif
2025-06-06 15:18 ` Zi Yan
2025-06-06 15:38   ` Usama Arif
2025-06-06 16:10     ` Zi Yan
2025-06-07  8:35       ` Lorenzo Stoakes
2025-06-08  0:04         ` Zi Yan
2025-06-09 11:13       ` Usama Arif
2025-06-09 13:19         ` Zi Yan
2025-06-09 14:11           ` Usama Arif
2025-06-09 14:16             ` Lorenzo Stoakes
2025-06-09 14:37               ` Zi Yan
2025-06-09 14:50                 ` Lorenzo Stoakes
2025-06-09 15:20                   ` Zi Yan
2025-06-09 19:40                     ` Lorenzo Stoakes
2025-06-09 19:49                       ` Zi Yan
2025-06-09 20:03                         ` Usama Arif
2025-06-09 20:24                           ` Zi Yan
2025-06-10 10:41                             ` Usama Arif
2025-06-10 14:03                         ` Lorenzo Stoakes
2025-06-10 14:20                           ` Zi Yan
2025-06-10 15:16                             ` Usama Arif [this message]
2025-06-09 15:32             ` Zi Yan
2025-06-06 17:37 ` David Hildenbrand
2025-06-09 11:34   ` Usama Arif
2025-06-09 13:28     ` Zi Yan
2025-06-07  8:18 ` Lorenzo Stoakes
2025-06-07  8:44   ` Lorenzo Stoakes
2025-06-09 12:07   ` Usama Arif
2025-06-09 12:12     ` Usama Arif
2025-06-09 14:58       ` Lorenzo Stoakes
2025-06-09 14:57     ` Lorenzo Stoakes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7b16ed90-659f-45b4-83e9-62781e5460a6@gmail.com \
    --to=usamaarif642@gmail.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@redhat.com \
    --cc=dev.jain@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=jyescas@google.com \
    --cc=kernel-team@meta.com \
    --cc=leitao@debian.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=npache@redhat.com \
    --cc=riel@surriel.com \
    --cc=ryan.roberts@arm.com \
    --cc=shakeel.butt@linux.dev \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox