Date: Wed, 3 Sep 2008 13:16:26 +0100 From: "kr Lekha" <kr.lekha@gmail.com> To: "Rui Paulo" <rpaulo@freebsd.org> Cc: freebsd-hackers@freebsd.org Subject: Re: killing a kthread Message-ID: <96b2ec350809030516y2d6f26d1h3cd7eb39231c4da0@mail.gmail.com> In-Reply-To: <20080903095605.GB21178@alpha.local> References: <96b2ec350809030134j73a61369m35395391a1218975@mail.gmail.com> <20080903095605.GB21178@alpha.local>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Thanks,
Lekha
On 9/3/08, Rui Paulo <rpaulo@freebsd.org> wrote:
>
> On Wed, Sep 03, 2008 at 09:34:47AM +0100, 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.
> > 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,
>
> When the thread finishes what it's doing, it should call kthread_exit().
>
> Regards,
> --
> Rui Paulo
>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?96b2ec350809030516y2d6f26d1h3cd7eb39231c4da0>
