DEBUG_ATOMIC_SLEEP spew in cgroup_task_dead() on next-20251104

From: Calvin Owens
Date: Tue Nov 04 2025 - 13:16:04 EST


Hi Tejun,

The following spews constantly for me on next-20251104 (w/ PREEMPT_RT):

[ 1.246079] [ T0] BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
[ 1.246079] [ T0] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 0, name: swapper/1
[ 1.246079] [ T0] preempt_count: 1, expected: 0
[ 1.246079] [ T0] RCU nest depth: 0, expected: 0
[ 1.246079] [ T0] 1 lock held by swapper/1/0:
[ 1.246079] [ T0] #0: ffffffff827d0060 (css_set_lock){+.+.}-{3:3}, at: cgroup_task_dead+0x18/0x23b
[ 1.246079] [ T0] CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Not tainted 6.18.0-rc4-next-20251104-x86-hardened #1 PREEMPT_{RT,LAZY}
[ 1.246079] [ T0] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-20240910_120124-localhost 04/01/2014
[ 1.246079] [ T0] Call Trace:
[ 1.246079] [ T0] <TASK>
[ 1.246079] [ T0] dump_stack_lvl+0x94/0xdb
[ 1.246079] [ T0] __might_resched+0x21b/0x240
[ 1.246079] [ T0] rt_spin_lock+0x62/0x1d0
[ 1.246079] [ T0] cgroup_task_dead+0x18/0x23b
[ 1.246079] [ T0] finish_task_switch+0x1a6/0x295
[ 1.246079] [ T0] __schedule+0x7ee/0xbc5
[ 1.246079] [ T0] schedule_idle+0x1a/0x30
[ 1.246079] [ T0] do_idle+0x1aa/0x1e5
[ 1.246079] [ T0] cpu_startup_entry+0x21/0x30
[ 1.246079] [ T0] start_secondary+0xc4/0xdb
[ 1.246079] [ T0] common_startup_64+0x13b/0x157
[ 1.246079] [ T0] </TASK>

Full dmesg is here: https://gist.githubusercontent.com/jcalvinowens/e1ec1153ddbff10cee5a96ad58f65205/raw/445966a3bfefd94cfca0cd17bcb76c07d31cb33e/gistfile1.txt
Kconfig is here: https://gist.githubusercontent.com/jcalvinowens/8dd543985e25e3d0329339c0d041f1f2/raw/197555de8482a1ffd0482c88dede0c13a42b9a69/gistfile1.txt

I'm guessing this is related to d245698d727a ("cgroup: Defer task cgroup
unlink until after the task is done switching out")? Is there any other
useful info I can provide?

Thanks,
Calvin