Re: [PATCH 1/1] mm/hugetlb: keep max_huge_pages when dissolving surplus folios

Andrew Morton <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.kernel.mm
Message-ID <[email protected]>
On Fri, 14 Aug 2026 16:30:27 +0800 Longlong Xia <[email protected]> wrote:

> From: Longlong Xia <[email protected]>
> 
> dissolve_free_hugetlb_folio() can remove a free folio as surplus when
> its node has surplus pages.  In that case remove_hugetlb_folio()
> decrements both nr_huge_pages and surplus_huge_pages, leaving the
> persistent pool size unchanged.
> 
> Updating max_huge_pages as if a persistent folio had been removed can
> therefore corrupt the persistent pool target and underflow it when
> max_huge_pages is zero.  Keep max_huge_pages unchanged for surplus
> folios, including the vmemmap restoration rollback path.

Thanks.

> Fixes: cb402bbdabca ("mm/hugetlb: fix surplus pages in dissolve_free_huge_page()")

That's a year old, so I'm assuming there's no urgency here.  I'll 
save the fix for later and shall await maintainer input.  While at it,
please suggest whether we should backport this.

AI review might have found a couple of bugs in the surrounding code.  If true,
they look rather nasty.

	https://sashiko.dev/#/patchset/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.