linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Gregory Price <gourry@gourry.net>, linux-mm@kvack.org, osalvador@suse.de
Cc: corbet@lwn.net, muchun.song@linux.dev, akpm@linux-foundation.org,
	hannes@cmpxchg.org, laoar.shao@gmail.com, mclapinski@google.com,
	joel.granados@kernel.org, jack@suse.cz,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Mel Gorman <mgorman@suse.de>, Michal Hocko <mhocko@suse.com>,
	Alexandru Moise <00moses.alexander00@gmail.com>,
	David Rientjes <rientjes@google.com>
Subject: Re: [RFC PATCH] mm, hugetlb: implement movable_gigantic_pages sysctl
Date: Mon, 20 Oct 2025 16:17:06 +0200	[thread overview]
Message-ID: <6fe3562d-49b2-4975-aa86-e139c535ad00@redhat.com> (raw)
In-Reply-To: <20251009161515.422292-1-gourry@gourry.net>

On 09.10.25 18:15, Gregory Price wrote:
> This reintroduces a concept removed by
> commit d6cb41cc44c6 ("mm, hugetlb: remove hugepages_treat_as_movable sysctl")
> 
> This sysctl provides some flexibility between multiple requirements which
> are difficult to square without adding significantly more complexity.
> 
> 1) onlining memory in ZONE_MOVABLE to maintain hotplug compatibility
> 2) onlining memory in ZONE_MOVABLE to increase reliability of hugepage
>     allocation.
> 
> When the user's intent for ZONE_MOVABLE is to allow more reliable huge
> page allocation (as opposed to enabling hotplugability), disallowing 1GB
> hugepages in this region this region is pointless.  So if hotplug is not
> a requirement, we can loosen the restrictions to allow 1GB gigantic pages
> in ZONE_MOVABLE.
> 
> Since 1GB can be difficult to migrate / has impacts on compaction /
> defragmentation, we don't enable this by default.  However, since there
> are scenarios where gigantic pages are migratable (hugetlb available in
> multiple places), we should allow use of these on zone movable regions.
> 
> Note: Boot-time CMA is not possible for driver-managed hotplug memory,
> as CMA requires the memory to be registered as SystemRAM at boot time.
> 
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Alexandru Moise <00moses.alexander00@gmail.com>
> Suggested-by: David Rientjes <rientjes@google.com>
> Signed-off-by: Gregory Price <gourry@gourry.net>
> Link: https://lore.kernel.org/all/20180201193132.Hk7vI_xaU%25akpm@linux-foundation.org/
> ---

I just remembered one thing, maybe Oscar knows what I mean:

At some point we discussed a possible issue when 
alloc_contig_range()/alloc_contig_pages() would try to allocate a 
gigantic folio and would stumble over movable gigantic folios (possibly 
triggering some recursion when trying to move that one? Not sure).

We wanted to avoid having one gigantic folio allocation try to move 
another gigantic folio allocation.

I think your patch would not change anything in that regard: when we 
scan for a suitable range in alloc_contig_pages_noprof() we call 
pfn_range_valid_contig() .

There, we simply give up whenever we spot any PageHuge(), preventing 
this issue.

However, it also means that we won't try moving 2MB folios to free up a 
1GB folio.

That could be supported by allowing for moving hugetlb folios when their 
size is small enough to be served by the buddy, and the size we are 
allocating is larger than the one of these folios.

-- 
Cheers

David / dhildenb



  reply	other threads:[~2025-10-20 14:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-09 16:15 Gregory Price
2025-10-20 14:17 ` David Hildenbrand [this message]
2025-10-20 14:22   ` Gregory Price
2025-10-20 16:05   ` Gregory Price
2025-10-20 16:35     ` Gregory Price

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=6fe3562d-49b2-4975-aa86-e139c535ad00@redhat.com \
    --to=david@redhat.com \
    --cc=00moses.alexander00@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=gourry@gourry.net \
    --cc=hannes@cmpxchg.org \
    --cc=jack@suse.cz \
    --cc=joel.granados@kernel.org \
    --cc=laoar.shao@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mclapinski@google.com \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --cc=rientjes@google.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