Skip to contentSkip to conversation

schedule_timeout() called with state TASK_RUNNING from fs/select.c

DISCUSSION Oleg Nesterov 2 participants 2 messages Jul 8, 2007 – Jul 10, 2007

lore
Share & tools
lore
#0 lore raw
Quoted 3 lines · Robert P. J. Day

as i understand it, schedule_timeout() should always be called with
a current->state of TASK_INTERRUPTIBLE or TASK_UNINTERRUPTIBLE, no?

No.

Yes, it is pointless to call schedule() if it is known that ->state == TASK_RUNNING, but sometimes the task doesn't know its state when it calls schedule/schedule_timeout, the state could be changed by try_to_wake_up().

See wait_event_timeout() as an example.

Oleg.

#1 lore raw
Quoted 5 lines · Oleg Nesterov
Quoted 3 lines · Robert P. J. Day

as i understand it, schedule_timeout() should always be called with
a current->state of TASK_INTERRUPTIBLE or TASK_UNINTERRUPTIBLE, no?

Quoted 8 lines

No.

Yes, it is pointless to call schedule() if it is known that ->state == TASK_RUNNING, but sometimes the task doesn't know its state when it calls schedule/schedule_timeout, the state could be changed by try_to_wake_up().

See wait_event_timeout() as an example.

fair enough. i already knew that, technically, it wasn't an error to call schedule_timeout() with state == TASK_RUNNING. i was just following up on something out of love's kernel book, and i got curious as to whether the above ever happened. now i know.

rday
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
========================================================================