Kthread kill

kr Lekha kr.lekha at gmail.com
Wed Sep 3 10:04:31 UTC 2008


Hi,
i wanted to kill a kthread created by my module, There is no actual
kthread_kill to kill it

hence I tried to send kill signal to thread
 psignal(p, SIGTERM);
psignal(p, SIGKILL);
killproc(p,"messeage");
and kthread_suspend()

Nothing seems to be killing the kthread, I still see it
[root@ /usr/src]# ps awx -l | grep kernel
 UID   PID    PPID CPU PRI NI   VSZ   RSS MWCHAN STAT  TT       TIME COMMAND
  0     1048     1      0     20   0     0       8      ktsusp      DL
??     0:00.01 [new_kernel_thread]


I have noticed that generally if kernel module wanted to kill a thread then
it calls
{
   wakeup(p);
   msleep(p,0); /*or tsleep*/
}

This puts the thread to sleep forever. However kthread_suspend also performs
same actions.
Does scheduler take care to killing it?

I read that after 2 min scheduler wakes up the thread and
eventually kills it,
i see the same kthread suspended even after a day

I would appreciate any thoughts in this reagard.
Thanks,
-lekha


More information about the freebsd-current mailing list