Re: [PATCH v2 0/2] mm/hugetlb_cgroup: move the per-node usage along with the folio

From: Andrew Morton

Date: Thu Sep 17 2026 - 23:49:12 EST


On Fri, 18 Sep 2026 10:56:09 +0800 Hongfu Li <hongfu.li@xxxxxxxxx> wrote:

> The per-node usage reported by hugetlb.<size>.numa_stat is accounted
> against folio_nid() in __hugetlb_cgroup_commit_charge() and
> __hugetlb_cgroup_uncharge_folio(), so it is only correct while a folio
> stays charged on the same node and in the same hugetlb_cgroup.
>
> Two paths move a folio which stays charged, and neither moves the usage
> with it. hugetlb_cgroup_migrate() only moves the hugetlb_cgroup pointers
> of a folio migrated to another node, and hugetlb_cgroup_move_parent()
> only moves the page_counter charges and the hugetlb_cgroup pointer of
> the folios of a dying cgroup. In both cases the node (or cgroup) which
> was charged keeps a usage which never goes away, while the node
> (or cgroup) which ends up uncharging the folio underflows as soon as
> the folio is freed.

Thanks.

> Fixes: f47761999052 ("hugetlb: add hugetlb.*.numa_stat file")
> Cc: stable@xxxxxxxxxxxxxxx

I'll queue these for the next merge window, with cc:stable. I don't
see a hurry to fix a four year old bug.