Trying to make kernel thread sleep

From: Dinesh Ahuja
Date: Mon Aug 21 2006 - 00:29:54 EST


Hi All,

I am trying to put kernel thread to sleep via
interruptible_sleep_on_timeout(). Body of kernel
thread function is as follows

static int print_taskinfo(void * data)
{
wait_queue_head_t wait;


init_waitqueue_head (&wait);
for (;;)
{
// do something useful here.
interruptible_sleep_on_timeout(&wait, HZ);
//check whether we have to break loop or
continue.
}
}

I am facing following kernel oops :

Unable to handle kernel NULL pointer dereference at
virtual address 00000005
printing eip:
c011905d
*pde = 00000000
Oops: 0002
CPU: 0
EIP: 0060:[<c011905d>] Tainted: PF
EFLAGS: 00010086

EIP is at interruptible_sleep_on_timeout [kernel] 0x2d
(2.4.20-6)
eax: c2cadfc4 ebx: 00000286 ecx: c2cadfac edx:
00000001
esi: 00000064 edi: c8dc7540 ebp: c2cadfbc esp:
c2cadfa4
ds: 0068 es: 0068 ss: 0068
Process insmod (pid: 3884, stackpage=c2cad000)
Stack: 00000000 c2cac000 00000f2b 00000000 c034c000
c8dc74c0 c2cadfec d087d1a1
00000001 c2cadfc8 c2cadfc8 00000000 00000000
00000000 00000000 d087d074
00000000 00000000 00000000 c010742d 00000000
00000000 00000000
Call Trace: [<d087d1a1>] print_taskinfo [hello1]
0x12d (0xc2cadfc0))
[<d087d074>] print_taskinfo [hello1] 0x0 (0xc2cadfe0))
[<c010742d>] kernel_thread_helper [kernel] 0x5
(0xc2cadff0))

Can anyone guide me where I am going wrong?

Regards
Dinesh



__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/