Date: Mon, 8 Sep 2008 17:26:12 -0400 From: John Baldwin <jhb@freebsd.org> To: freebsd-current@freebsd.org Cc: kr Lekha <kr.lekha@gmail.com> Subject: Re: Kthread kill Message-ID: <200809081726.13043.jhb@freebsd.org> In-Reply-To: <96b2ec350809030232v5586ea44nf6ead7d856f72634@mail.gmail.com> References: <96b2ec350809030232v5586ea44nf6ead7d856f72634@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 03 September 2008 05:32:00 am kr Lekha wrote:
> 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.
Your kthread has to explicitly check for a kill request in its main loop and
call kthread_exit() or some such. There is no force-kill for kthreads.
--
John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809081726.13043.jhb>
