Re: [RFC PATCH 05/10] memcg: no refilling stock from obj_cgroup_release
From: Sebastian Andrzej Siewior
Date: Fri Mar 14 2025 - 07:26:55 EST
On 2025-03-13 23:15:06 [-0700], Shakeel Butt wrote:
> obj_cgroup_release is called when all the references to the objcg has
"references to the objcg have"
> been released i.e. no more memory objects are pointing to it. Most
> probably objcg->memcg will be pointing to some ancestor memcg and at the
> moment, in obj_cgroup_release, the kernel call
> obj_cgroup_uncharge_pages() to uncharge last remaining memory.
This sounds somehow funny. I think the point is to uncharge the pages
without tampering memcg_stock because it is unnecessary.
> However obj_cgroup_uncharge_pages() refills the local stock. There is
> no need to refill the local stock with some ancestor memcg and flush the
> local stock. In addition this removes the requirement to only call
> obj_cgroup_put() outside of local_lock.
>
> Signed-off-by: Shakeel Butt <shakeel.butt@xxxxxxxxx>
Sebastian