]> Git Repo - linux.git/commit
memcontrol: only transfer the memcg data for migration
authorNhat Pham <[email protected]>
Fri, 6 Oct 2023 18:46:27 +0000 (11:46 -0700)
committerAndrew Morton <[email protected]>
Wed, 18 Oct 2023 21:34:17 +0000 (14:34 -0700)
commit85ce2c517ade0d51b7ad95f2e88be9bbe294379a
tree4dedecac7b55297138eeeecfe0ec4ae729803a68
parent4b569387c0d566db288e7c3e1b484b43df797bdb
memcontrol: only transfer the memcg data for migration

For most migration use cases, only transfer the memcg data from the old
folio to the new folio, and clear the old folio's memcg data.  No charging
and uncharging will be done.

This shaves off some work on the migration path, and avoids the temporary
double charging of a folio during its migration.

The only exception is replace_page_cache_folio(), which will use the old
mem_cgroup_migrate() (now renamed to mem_cgroup_replace_folio).  In that
context, the isolation of the old page isn't quite as thorough as with
migration, so we cannot use our new implementation directly.

This patch is the result of the following discussion on the new hugetlb
memcg accounting behavior:

https://lore.kernel.org/lkml/20231003171329.GB314430@monkey/

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Nhat Pham <[email protected]>
Suggested-by: Johannes Weiner <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Cc: Frank van der Linden <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Mike Kravetz <[email protected]>
Cc: Muchun Song <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Roman Gushchin <[email protected]>
Cc: Shakeel Butt <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Tejun heo <[email protected]>
Cc: Yosry Ahmed <[email protected]>
Cc: Zefan Li <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
include/linux/memcontrol.h
mm/filemap.c
mm/memcontrol.c
This page took 0.057847 seconds and 4 git commands to generate.