[Devel] [PATCH RH7] mm/memcontrol: remove excess put of memory cgroup id refcount on css free

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Tue Jul 11 08:37:16 MSK 2023


please ignore, see v2

On 11.07.2023 11:47, Pavel Tikhomirov wrote:
> The removed hunk comes from rhel partial porting of [1], there they
> added mem_cgroup_id_put on memcg free instead of offline. But they also
> didn't do refcounting in mem_cgroup_id_put, only removed id from idr.
> 
> Now we do actual refcounting in mem_cgroup_id_put, and atomic_set(1) and
> css_get in mem_cgroup_css_online are paired with mem_cgroup_id_put in
> mem_cgroup_css_offline. The call in free path is excess and we should
> remove it.
> 
> This is not a critical excess refcount put, as it happened on late
> cgroup freeing stage, which can only happen after this id refcount
> reaches zero, which leads to css_put, which leads to freeing. So nobody
> cares about id refcount at this point.
> 
> https://jira.vzint.dev/browse/PSBM-148818
> 
> Fixes: 9dcef96ce3e2 ("ms/mm: memcontrol: fix cgroup creation failure after many small jobs") [1]
> Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
> ---
>   mm/memcontrol.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 3a5e89b913bd..c7c15c6dd6fb 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -6818,8 +6818,6 @@ static void __mem_cgroup_free(struct mem_cgroup *memcg)
>   
>   	mem_cgroup_remove_from_trees(memcg);
>   
> -	mem_cgroup_id_put(memcg);
> -
>   	for_each_node(node)
>   		free_mem_cgroup_per_zone_info(memcg, node);
>   

-- 
Best regards, Tikhomirov Pavel
Senior Software Developer, Virtuozzo.


More information about the Devel mailing list