killing a kthread

David Schultz das at FreeBSD.ORG
Wed Sep 3 21:40:02 UTC 2008


On Wed, Sep 03, 2008, kr Lekha wrote:
> I understand when thread finishes it should call kthread_exit().
> but if this thread was suspended before it finished, it might not be able to
> call kthread_exit().
> 
> Due to which we still see the thread suspended. I am unable to kill it
> even with killproc / psignal with in the kernel module.

That's by design. Kernel threads can hold arbitrary kernel
resources, and there's no mechanism to clean up after them
automatically. They are expected to clean up after themselves and
exit gracefully. In your case, you'll need to wake up the
suspended thread and somehow notify it that you want it to
terminate.


More information about the freebsd-hackers mailing list