wait_event_interruptible_timeout-bug

Submitted by Anonymous
on January 19, 2009 - 2:44am

I am using kernel 2.6.19.2 with CONFIG_PREEMPT.

1. wait_event_interruptible_timeout internally uses schedule_timeout. schedule_timeout uses __mod_timer to configure a timer, but is __mod_timer capable to taking care of preemption. I was going through kernel/timer.c, the function mod_timer internally uses __mod_timer and clearly states that mod_timer is the only way for safe un-serialized concurrent access to modify the timer.

2. If I use wait_event_interruptible_timeout with small timeouts (1 jiffy), it times of randomly.

2. Again wait_event_interruptible_timeout is not atomic, then is it possible that prepare_to_wait changed the process state to TASK_INTERRUPTIBLE but schedule_timeout was called with some other state? or am i goofing up something?

Basically, I am running a multi-threaded application with about 18 threads. Sometimes my application is getting stuck at schedule_timeout.

-SG