Re: kernel_thread function

Andi Kleen (ak@muc.de)
30 Dec 1999 13:06:14 +0100


prakash@rnd.cts-corp.com writes:

> Hi,
> I've just been going through the kernel_thread function in kernel 2.2.5.
> Is there any restriction as to when this function is called? I tried to
> create a kernel thread in one of the TCP input functions(i.e. when it
> receives a packet) and it always gives me a kernel panic. Could someone
> tell me when exactly a kernel thread is created. I think I am trying to
> call it in an intr handler. Is this the problem?

TCP input functions run in bottom half (interrupt) context. kernel_thread
can only be used from process context (e.g. from a system call or in a
module's init_module() function)

>
> My actual requirement is to create a kernel thread in the TCP/IP module
> which will be in a continuous while loop polling for a certain condition.
> Any links in this regard will be great.

I hope you mean sleeping, not polling. You have to sleep, because
Linux kernel threads are not preemptive.

-Andi

-- 
This is like TV. I don't like TV.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/