mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
mm/hugetlb_cgroup: move per-node usage on cgroup reparenting
hugetlb_cgroup_css_offline() hands the folios of a dying cgroup over to
its parent with hugetlb_cgroup_move_parent(), which moves the page_counter
charges and the hugetlb_cgroup pointer of the folio but not its per-node
usage. The parent's hugetlb.<size>.numa_stat is short by that usage while
they are charged, and underflows once they are freed, exposing incorrect
per-node usage values to userspace.
Move the per-node usage to the parent as well. The folios keep their node
here, so only the cgroup which holds the usage changes.
Link: https://lore.kernel.org/20260918-for-hugetlb-charge-v2-2-2b6d8c2bdc36@kylinos.cn
Fixes: f477619990 ("hugetlb: add hugetlb.*.numa_stat file")
Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Muchun Song <muchun.song@linux.dev>
Cc: Colin Ian King <colin.i.king@gmail.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Kees Cook <kees@kernel.org>
Cc: Mina Almasry <almasrymina@google.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: <stable@vger.kernel.org>
This commit is contained in:
parent
fe0ba1909c
commit
23fac055c2
|
|
@ -241,6 +241,8 @@ static void hugetlb_cgroup_move_parent(int idx, struct hugetlb_cgroup *h_cg,
|
|||
/* Take the pages off the local counter */
|
||||
page_counter_cancel(counter, nr_pages);
|
||||
|
||||
hugetlb_cgroup_move_usage(h_cg, parent, folio, folio);
|
||||
|
||||
set_hugetlb_cgroup(folio, parent);
|
||||
out:
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user