David Woodhouse wrote:
>
> [EMAIL PROTECTED] said:
> > Unfortunately schedule_timeout() doesn't actually call del_timer_sync.
> >
>
> Er,... it did in -ac14. It looked 'obviously correct' to me. So I sent the
> patch to Alan with with a question mark indicating that I wanted him to
> comment rather than just apply it. In hindsight, perhaps I should have made
> that more explicit.
[EMAIL PROTECTED] :-)
> Why _doesn't_ it work, though?
It needs a timer_exit(&timer) at the end of the handler:
static void process_timeout(unsigned long __data)
{
struct task_struct * p = (struct task_struct *) __data;
wake_up_process(p);
+ timer_exit(&p->process_timeout_timer);
}
The timer_exit() call tells del_timer_sync() that the timer handler has
done all its work, and that del_timer_sync() may now stop spinning.
It's pretty 'orrible...
I think this is a worthwhile change. With the code as it stands there's
a good chance that the handler will call wake_up_process() on a
currently-running process, or even on one which has just gone back to
sleep and didn't want to wake up a few microseconds later. Has this
been observed in the wild??
So the patch should:
- add 'struct timer_list process_timeout_timer;' to struct task_struct
- Arrange for 'process_timeout_timer' to be initialised correctly
via INIT_TASK() and probably in sys_clone() somewhere via init_timer()
- Alter process_timeout() and schedule_timeout() appropriately.
-
Linux SMP list: FIRST see FAQ at http://www.irisa.fr/prive/dmentre/smp-howto/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]