[PATCH v3 2/3] hugetlb: memcg: account hugetlb-backed memory in memory controller (fix)

From: Nhat Pham
Date: Wed Oct 04 2023 - 15:45:13 EST


Ensure hugetlb folio migration also transfers the memcg metadata.

This fixlet should be squashed to the following patch:
https://lore.kernel.org/lkml/20231003001828.2554080-3-nphamcs@xxxxxxxxx/
hugetlb: memcg: account hugetlb-backed memory in memory controller

Suggested-by: Johannes Weiner <hannes@xxxxxxxxxxx>
Signed-off-by: Nhat Pham <nphamcs@xxxxxxxxx>
---
mm/migrate.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index 7d1804c4a5d9..6034c7ed1d65 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -633,8 +633,7 @@ void folio_migrate_flags(struct folio *newfolio, struct folio *folio)

folio_copy_owner(newfolio, folio);

- if (!folio_test_hugetlb(folio))
- mem_cgroup_migrate(folio, newfolio);
+ mem_cgroup_migrate(folio, newfolio);
}
EXPORT_SYMBOL(folio_migrate_flags);

--
2.34.1