Re: [PATCH v2 26/28] mm: memcontrol: refactor memcg_reparent_objcgs()

From: Qi Zheng

Date: Sun Dec 21 2025 - 22:56:52 EST




On 12/18/25 9:45 PM, Johannes Weiner wrote:
On Wed, Dec 17, 2025 at 03:27:50PM +0800, Qi Zheng wrote:
+static void memcg_reparent_objcgs(struct mem_cgroup *src)
+{
+ struct obj_cgroup *objcg = rcu_dereference_protected(src->objcg, true);
+ struct mem_cgroup *dst = parent_mem_cgroup(src);
+
+ reparent_locks(src, dst);
+
+ __memcg_reparent_objcgs(src, dst);

Please have __memcg_reparent_objcgs() return the dead objcg for the
percpu_ref_kill(), instead of doing the deref twice.

OK, will do.


And please use @child, @parent (or @memcg, @parent) throughout instead
of @src and @dst.

OK.


+
+ reparent_unlocks(src, dst);
percpu_ref_kill(&objcg->refcnt);

With that,

Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>

Thanks!