mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] mm/hugetlb: fix surplus accounting and availability checks during demotion
@ 2026-08-23  3:43 Longlong Xia
  2026-08-23  3:43 ` [PATCH 1/2] mm/hugetlb: preserve source surplus accounting " Longlong Xia
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Longlong Xia @ 2026-08-23  3:43 UTC (permalink / raw)
  To: muchun.song, osalvador, akpm, david, mike.kravetz, yuzhao,
	linux-mm, linux-kernel
  Cc: Longlong Xia

From: Longlong Xia <xialonglong@kylinos.cn>

This series fixes two problems in the hugetlb demote path.

Patch 1 fixes surplus accounting in the source hstate.
demote_pool_huge_page() removes every source folio as a persistent
folio, but a free folio may instead account for one of the source
hstate's surplus pages (for example after a vmemmap restoration
failure). Removing such a folio without adjusting surplus_huge_pages
makes the persistent count underflow, and later subtracting it from
max_huge_pages can underflow that counter as well.

Patch 2 fixes an availability overcount in the sysfs demote path. The
sysfs trigger checks whether any page is available but then passes the
entire request to demote_pool_huge_page(), which can remove free huge
pages that back existing reservations. With two free pages and one
reservation, a request for two pages removes both and leaves the
reservation without a backing page.

Both patches carry Fixes tags.

Longlong Xia (2):
  mm/hugetlb: preserve source surplus accounting during demotion
  mm/hugetlb: cap demotion at currently available free pages

 mm/hugetlb.c       | 57 ++++++++++++++++++++++++++++++++++++++++++----
 mm/hugetlb_sysfs.c | 10 ++++----
 2 files changed, 57 insertions(+), 10 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-28 23:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-23  3:43 [PATCH 0/2] mm/hugetlb: fix surplus accounting and availability checks during demotion Longlong Xia
2026-08-23  3:43 ` [PATCH 1/2] mm/hugetlb: preserve source surplus accounting " Longlong Xia
2026-08-23  3:43 ` [PATCH 2/2] mm/hugetlb: cap demotion at currently available free pages Longlong Xia
2026-08-28 23:10 ` [PATCH 0/2] mm/hugetlb: fix surplus accounting and availability checks during demotion Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®