Re: [PATCH] mm/hugetlb: fix subpool accounting after cgroup charge failure
From: Andrew Morton
Date: Mon Apr 27 2026 - 11:13:45 EST
On Mon, 27 Apr 2026 22:52:48 +0800 Catherine <enderaoelyther@xxxxxxxxx> wrote:
> alloc_hugetlb_folio() calls hugepage_subpool_get_pages() when map_chg
> is set. For subpools with max_hpages, that increments used_hpages even
> when the returned gbl_chg is positive.
>
> If a later hugetlb cgroup charge fails, the cleanup currently calls
> hugepage_subpool_put_pages() only for !gbl_chg. The gbl_chg > 0 path
> therefore leaks one used_hpages charge per failure.
>
> Always undo the subpool charge after a successful subpool get. Keep the
> global reservation accounting under !gbl_chg, because only that path
> consumed a reservation from the subpool.
Thanks.
We do prefer full, real names for kernel alterations. Can you please
provide that?