Hi,
We've recently hit this on 5.4.124:
WARNING: CPU: 5 PID: 35 at kernel/kthread.c:75
kthread_is_per_cpu+0x21/0x30
After some digging, I figured out that this should be fixed by commit
3a7956e25e1d ("kthread: Fix PF_KTHREAD vs to_kthread() race") in mainline.
It Fixes: ac687e6e8c26 ("kthread: Extract KTHREAD_IS_PER_CPU")
3a7956e25e1d has been backported to 5.12.x and 5.11.x:
- 5.12.4: as 163dd7fa459faebe055bcbebf9e088bae04f8e33
- 5.11.21: as 42e4caa93282ade6a143ff320d71062874dd3a5a
Makes sense, as ac687e6e8c26 originally landed in 5.11.
But it appears that since then ac687e6e8c26 has also been backported to
LTS trees:
- 5.10.14: as b20475a80b4bd2c7bc720c3a9a8337c36b20dd8c
- 5.4.96: as 5b1e4fc2984eab30c5fffbf2bd1f016577cadab6
- 4.19.174: as fbad32181af9c8c76698b16115c28a493c26a2ee
- 4.14.220: as a9b2e4a94eee352e0b3e863045e7379d83131ee2
Maybe those trees could use a backport of 3a7956e25e1d as well then?
Cheers,
Jakub.