How do I kill a kernel thread? And do I really want to do so?

As I've learned from this question, [bracketed] processes listed by the ps aux command are kernel threads. So is there a way to kill them from the command line? If not, I guess the reason for that is to save the user from a higher risk of getting a kernel panic, right?


You can not kill kernel threads, or any process that is blocked in the D state, because signals are only delivered when the kernel returns to user mode. Aside from the technical limitation of signal delivery, killing a thread in the middle of kernel code would corrupt the system as the kernel code may be holding an important resource at the time, such as a spin lock or mutex, and killing it would prevent those resources from being released.

If you have a process that is stuck in the D state for a prolonged period of time, then you have a kernel bug. See https://wiki.ubuntu.com/KernelTeam/KernelTeamBugPolicies for tips on reporting it.


Kernel threads are necessary threads created by your Kernel to manage your system.

Not all are necessary but all (most) all beneficial and require mostly no extra resources, there is no reason why one would under normal conditions think about killing a Kernel thread.

Linux Kernel can create an destroy those threads when necessary, you should not worry about them and killing under most circumstances is not something you can do.