diff options
| author | Muchun Song <[email protected]> | 2025-03-06 02:31:33 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2025-03-17 00:40:24 +0000 |
| commit | 73f839b6d2ed75f281bd75aeb68e81bce373bdee (patch) | |
| tree | c16eddc1ff554a9a869796f0b81c86d0ed704703 /mm/filemap.c | |
| parent | mm/vma: do not register private-anon mappings with khugepaged during mmap (diff) | |
| download | kernel-73f839b6d2ed75f281bd75aeb68e81bce373bdee.tar.gz kernel-73f839b6d2ed75f281bd75aeb68e81bce373bdee.zip | |
mm: memcontrol: fix swap counter leak from offline cgroup
Commit 6769183166b3 removed the parameter of id from swap_cgroup_record()
and get the memcg id from mem_cgroup_id(folio_memcg(folio)). However, the
caller of it may update a different memcg's counter instead of
folio_memcg(folio).
E.g. in the caller of mem_cgroup_swapout(), @swap_memcg could be
different with @memcg and update the counter of @swap_memcg, but
swap_cgroup_record() records the wrong memcg's ID. When it is uncharged
from __mem_cgroup_uncharge_swap(), the swap counter will leak since the
wrong recorded ID.
Fix it by bringing the parameter of id back.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 6769183166b3 ("mm/swap_cgroup: decouple swap cgroup recording and clearing")
Signed-off-by: Muchun Song <[email protected]>
Reviewed-by: Kairui Song <[email protected]>
Cc: Chris Li <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Roman Gushchin <[email protected]>
Cc: Shakeel Butt <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'mm/filemap.c')
0 files changed, 0 insertions, 0 deletions
