Re: [PATCH -v2 next 2/4] memcg: call the free function when allocation of pn fails

From: Roman Gushchin
Date: Tue Jan 14 2025 - 13:37:29 EST


On Tue, Jan 14, 2025 at 12:25:17PM +0000, Chen Ridong wrote:
> From: Chen Ridong <chenridong@xxxxxxxxxx>
>
> The 'free_mem_cgroup_per_node_info' function is used to free
> the 'mem_cgroup_per_node' struct. Using 'pn' as the input for the
> free_mem_cgroup_per_node_info function will be much clearer.
> Call 'free_mem_cgroup_per_node_info' when 'alloc_mem_cgroup_per_node_info'
> fails, to free 'pn' as a whole, which makes the code more cohesive.
>
> Signed-off-by: Chen Ridong <chenridong@xxxxxxxxxx>
> Reviewed-by: Michal Koutný <mkoutny@xxxxxxxx>
> Acked-by: Shakeel Butt <shakeel.butt@xxxxxxxxx>

Reviewed-by: Roman Gushchin <roman.gushchin@xxxxxxxxx>