[Devel] [PATCH RH7 v2 2/2] mm/memcontrol: remove excess css_get on task migration with swap

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Tue Jul 11 07:32:04 MSK 2023


Before [1] we took css refcount for each swap page, after that we take
memory cgroup id refcount instead, that's why we don't need to get css
refcount on destination cgroup when moving swap page to it.

https://jira.vzint.dev/browse/PSBM-148818

Fixes: 9dcef96ce3e2 ("ms/mm: memcontrol: fix cgroup creation failure after many small jobs") [1]
Fixes: 11870ae0f7b6 ("ms/mm: memcontrol: fix memcg id ref counter on swap charge move")
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 mm/memcontrol.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index c7c15c6dd6fb..a2fe48d93d02 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4356,18 +4356,6 @@ static int mem_cgroup_move_swap_account(swp_entry_t entry,
 	if (swap_cgroup_cmpxchg(entry, old_id, new_id) == old_id) {
 		mem_cgroup_swap_statistics(from, false);
 		mem_cgroup_swap_statistics(to, true);
-		/*
-		 * This function is only called from task migration context now.
-		 * It postpones page_counter and refcount handling till the end
-		 * of task migration(mem_cgroup_clear_mc()) for performance
-		 * improvement. But we cannot postpone css_get(to)  because if
-		 * the process that has been moved to @to does swap-in, the
-		 * refcount of @to might be decreased to 0.
-		 *
-		 * We are in attach() phase, so the cgroup is guaranteed to be
-		 * alive, so we can just call css_get().
-		 */
-		css_get(&to->css);
 		return 0;
 	}
 	return -EINVAL;
-- 
2.41.0



More information about the Devel mailing list