Re: [PATCH v2] cgroup: Avoid iteration of dying tasks with zero refcount

From: Tejun Heo

Date: Fri Sep 11 2026 - 13:09:26 EST


On Fri, Sep 11, 2026 at 06:11:42PM +0200, Michal Koutný wrote:
> On Tue, Sep 08, 2026 at 05:55:45PM +0200, Michal Koutný <mkoutny@xxxxxxxx> wrote:
> > Though, the fix loses a bit of elegance. Hm, thinking...
>
> So, it occurs to me that the ->live based predicate from v2 might break
> CSS_TASK_ITER_WITH_DEAD callers (zombies they asked for would be
> skipped).
> We need to distinguish between (both on dying_tasks list):
> - regular zombies waiting to be reaped and
> - RCU remnant tasks that are going to be free'd.
> IIUC these two are split on the ->usage count. (Correct me if I'm
> wrong.)
>
> I'm starting to like the tryget_task_struct() approach from v1 again.

Yeah, let's go back to v1. Sorry about the noise.

Thanks.

--
tejun