The commit is pushed to "branch-rh7-3.10.0-1160.90.1.vz7.200.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after rh7-3.10.0-1160.90.1.vz7.200.6 ------> commit 07d2e346225d112623770860050fbe4a10b4e075 Author: Pavel Tikhomirov <ptikhomi...@virtuozzo.com> Date: Tue Jul 11 12:32:04 2023 +0800
mm/memcontrol: remove excess css_get on task migration with swap 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 mFixes: 9dcef96ce3e2 ("ms/mm: memcontrol: fix cgroup creation failure after many small jobs") [1] mFixes: 11870ae0f7b6 ("ms/mm: memcontrol: fix memcg id ref counter on swap charge move") Signed-off-by: Pavel Tikhomirov <ptikhomi...@virtuozzo.com> ================= Patchset description: memcg: fixes for memory cgroup id refcounting Complete memcg id refcount design: - on cgroup online get css refcount and set memcg id refctount to 1 - on cgroup offline put memcg id refcount - on swapout: - if cgroup memcg id refcount is 0 (not online), use parent cgroup - if cgroup memcg id refcount is >0, get it (previously in rh7 we got css refcount instead) - on swapin put memcg id refcount (previously in rh7 we put css refcount instead) - on charge move from one to another cgroup put memcg id refctount on "from" cgroup and get it on "to" cgroup (previously in rh7 we put css refcount on "from" and get on "to") - on last memcg id refctount put also put css refcount Charge move is a bit tricky: we get "to" memcg id refcount in mem_cgroup_move_charge_pte_range, and put "from" memcg id refcount later in __mem_cgroup_clear_mc. So, in the first patch of this series we remove leftover memcg id refcount put on memcg free path, and in the second patch we remove leftover "to" css refcount get in task move code for moved swap. https://jira.vzint.dev/browse/PSBM-148818 Signed-off-by: Pavel Tikhomirov <ptikhomi...@virtuozzo.com> Pavel Tikhomirov (2): mm/memcontrol: remove excess put of memory cgroup id refcount on css free mm/memcontrol: remove excess css_get on task migration with swap --- 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; _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel