On Wed, Oct 10, 2007 at 07:50:52AM -0400, Steven Rostedt wrote:
Yes right. I guess I spent too much time thinking about the 'broadcast
IPI' case where NEED_RESCHED is only set by the handler. In the case
where we 'reschedule' on a specific CPU the flag is set and IPI sent.
One more thing. test_thread_flag() uses thread info of the current
thread. But, if __schedule() did a context switch then it is possible
the NEED_RESCHED flag was set in the previous task, instead of current.
Does that make sense? The resched flags get cleared at the begining
of __schedule (as they should). But, if we really want that loop to
be valid shouldn't the flags be copied to the current task. Something
like the following after the context switch:
if (test_and_clear_tsk_thread_flag(prev, TIF_NEED_RESCHED))
set_tsk_need_resched(current);
if (test_and_clear_tsk_thread_flag(prev, TIF_NEED_RESCHED_DELAYED))
set_tsk_need_resched_delayed(current);
Don't we also need to worry about the flags being left set in the
previous task? That is why I think a test_and_clear would make sense.
But, your argument about axing the loop altogether makes sense as well.
--
Mike
-