Re: [PATCH v2] cgroup: Wait for dying tasks to leave on rmdir

From: Sebastian Andrzej Siewior

Date: Wed Mar 25 2026 - 08:08:10 EST


On 2026-03-24 10:17:36 [-1000], Tejun Heo wrote:
> Hello,
Hi,

> I'll apply this for now. Can you please try to reproduce the problem with
> the patches applied? How reliably does it reproduce? How is it stuck? Are
> tasks waiting on the waitq indefinitely with populated stuck at 1?

With the patches applied the test suite works. But now I accidentally did
poweroff :

| [ OK ] Finished systemd-poweroff.service - System Power Off.
| [ OK ] Reached target poweroff.target - System Power Off.
| INFO: task systemd:1 blocked for more than 10 seconds.
| Not tainted 7.0.0-rc5+ #167
| "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
| task:systemd state:D stack:0 pid:1 tgid:1 ppid:0 task_flags:0x400100 flags:0x00080000
| Call Trace:
| <TASK>
| __schedule+0x3d4/0xf80
| schedule+0x27/0xd0
| cgroup_drain_dying+0xb7/0x1b0
| cgroup_rmdir+0x2f/0x100
| kernfs_iop_rmdir+0x6a/0xd0
| vfs_rmdir+0x11a/0x280
| filename_rmdir+0x16f/0x1e0
| __x64_sys_unlinkat+0x58/0x70
| do_syscall_64+0x119/0x5a0
| entry_SYSCALL_64_after_hwframe+0x76/0x7e
| RIP: 0033:0x7f06b8b7fc17
| RSP: 002b:00007ffe37f96c98 EFLAGS: 00000206 ORIG_RAX: 0000000000000107
| RAX: ffffffffffffffda RBX: 000055ee562eba40 RCX: 00007f06b8b7fc17
| RDX: 0000000000000200 RSI: 000055ee562eba53 RDI: 000000000000000c
| RBP: 000000000000000d R08: 000055ee562eba40 R09: 0000000000000000
| R10: 00000000000007a0 R11: 0000000000000206 R12: 000055ee5639daa0
| R13: 0000000000000000 R14: 000055ee562eba53 R15: 000055ee562ec030
| </TASK>

This is not PREEMPT_RT and I can reproduce it also as of commit
6680c162b4850 ("selftests/cgroup: Don't require synchronous populated
update on task exit").
The reboot command is also affected in the same way. systemd is 260-1 in
case it should matter.

> Thanks.
>
Sebastian