[PATCH] mm: memcontrol: fix swap counter leak from offline cgroup

Muchun Song posted 1 patch 10 months ago
mm/memcontrol-v1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] mm: memcontrol: fix swap counter leak from offline cgroup
Posted by Muchun Song 10 months ago
The commit 73f839b6d2ed addressed an issue regarding the swap
counter leak that occurred from an offline cgroup. However, the
commit 89ce924f0bd4 modified the parameter from @swap_memcg to
@memcg (presumably this alteration was introduced while resolving
conflicts). Fix this problem by reverting this minor change.

Fixes: 89ce924f0bd4 ("mm: memcontrol: move memsw charge callbacks to v1")
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
 mm/memcontrol-v1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c
index 8660908850dc8..4a9cf27a70af0 100644
--- a/mm/memcontrol-v1.c
+++ b/mm/memcontrol-v1.c
@@ -620,7 +620,7 @@ void memcg1_swapout(struct folio *folio, swp_entry_t entry)
 		mem_cgroup_id_get_many(swap_memcg, nr_entries - 1);
 	mod_memcg_state(swap_memcg, MEMCG_SWAP, nr_entries);
 
-	swap_cgroup_record(folio, mem_cgroup_id(memcg), entry);
+	swap_cgroup_record(folio, mem_cgroup_id(swap_memcg), entry);
 
 	folio_unqueue_deferred_split(folio);
 	folio->memcg_data = 0;
-- 
2.20.1
Re: [PATCH] mm: memcontrol: fix swap counter leak from offline cgroup
Posted by Roman Gushchin 10 months ago
Muchun Song <songmuchun@bytedance.com> writes:

> The commit 73f839b6d2ed addressed an issue regarding the swap
> counter leak that occurred from an offline cgroup. However, the
> commit 89ce924f0bd4 modified the parameter from @swap_memcg to
> @memcg (presumably this alteration was introduced while resolving
> conflicts). Fix this problem by reverting this minor change.
>
> Fixes: 89ce924f0bd4 ("mm: memcontrol: move memsw charge callbacks to v1")
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>

Acked-by: Roman Gushchin <roman.gushchin@linux.dev>

Thanks!
Re: [PATCH] mm: memcontrol: fix swap counter leak from offline cgroup
Posted by Shakeel Butt 10 months ago
On Thu, Apr 10, 2025 at 04:18:12PM +0800, Muchun Song wrote:
> The commit 73f839b6d2ed addressed an issue regarding the swap
> counter leak that occurred from an offline cgroup. However, the
> commit 89ce924f0bd4 modified the parameter from @swap_memcg to
> @memcg (presumably this alteration was introduced while resolving
> conflicts). Fix this problem by reverting this minor change.
> 
> Fixes: 89ce924f0bd4 ("mm: memcontrol: move memsw charge callbacks to v1")
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>

Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Re: [PATCH] mm: memcontrol: fix swap counter leak from offline cgroup
Posted by Johannes Weiner 10 months ago
On Thu, Apr 10, 2025 at 04:18:12PM +0800, Muchun Song wrote:
> The commit 73f839b6d2ed addressed an issue regarding the swap
> counter leak that occurred from an offline cgroup. However, the
> commit 89ce924f0bd4 modified the parameter from @swap_memcg to
> @memcg (presumably this alteration was introduced while resolving
> conflicts). Fix this problem by reverting this minor change.
> 
> Fixes: 89ce924f0bd4 ("mm: memcontrol: move memsw charge callbacks to v1")
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>

Ah, those patches got reordered because yours was a fix and mine a
cleanup. Good catch.

Acked-by: Johannes Weiner <hannes@cmpxchg.org>