[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250314113533.jNrVXeyr@linutronix.de>
Date: Fri, 14 Mar 2025 12:35:33 +0100
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: Shakeel Butt <shakeel.butt@...ux.dev>,
Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Muchun Song <muchun.song@...ux.dev>, linux-mm@...ck.org,
cgroups@...r.kernel.org, linux-kernel@...r.kernel.org,
Meta kernel team <kernel-team@...a.com>
Subject: Re: [RFC PATCH 06/10] memcg: do obj_cgroup_put inside drain_obj_stock
On 2025-03-14 11:17:28 [+0100], Vlastimil Babka wrote:
> On 3/14/25 07:15, Shakeel Butt wrote:
> > Previously we could not call obj_cgroup_put() inside the local lock
> > because on the put on the last reference, the release function
> > obj_cgroup_release() may try to re-acquire the local lock. However that
> > chain has been broken. Now simply do obj_cgroup_put() inside
> > drain_obj_stock() instead of returning the old objcg.
> >
> > Signed-off-by: Shakeel Butt <shakeel.butt@...ux.dev>
>
> Hm is this really safe? I can see obj_cgroup_release() doing
> percpu_ref_exit() -> kfree(), do we have guaranteed that allocation won't be
> also in a kmemcg and recurse?
This was like this until commit
5675114623872 ("mm/memcg: protect memcg_stock with a local_lock_t")
at which point the put had to happen outside. This "percpu_ref_exit() ->
kfree()" was also prior this commit.
Sebastian
Powered by blists - more mailing lists