public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* schedule_timeout()
@ 2002-08-20 17:41 Lahti Oy
  2002-08-20 18:40 ` schedule_timeout() Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Lahti Oy @ 2002-08-20 17:41 UTC (permalink / raw)
  To: linux-kernel

Why does schedule_timeout() take a signed long as an argument and then check
for possible negative values? Wouldn't it be better to just take an unsigned
long as argument, thus eliminating all dumb checks in the code?

Also, couldn't MAX_SCHEDULE_TIMEOUT be defined zero to make checking for it
faster (actually I did find five calls to schedule_timeout() using zero
timeout, but couldn't they just use plain schedule() instead?)?

Another issue I found concerns setting current task state to TASK_RUNNING
after calling schedule_timeout(). This seems to be done in many parts of the
kernel, though Kernel-API documentations found from kernelnewbies.org seem
to claim that task state is guaranteed to be TASK_RUNNING after
schedule_timeout() returns. Is the documentation faulty or does the kernel
have obsoleted code?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: schedule_timeout()
  2002-08-20 17:41 schedule_timeout() Lahti Oy
@ 2002-08-20 18:40 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2002-08-20 18:40 UTC (permalink / raw)
  To: Lahti Oy; +Cc: linux-kernel

Lahti Oy wrote:
> 
> Why does schedule_timeout() take a signed long as an argument and then check
> for possible negative values? Wouldn't it be better to just take an unsigned
> long as argument, thus eliminating all dumb checks in the code?

Because someone may do:

	schedule_timeout(when_i_want_to_wake - jiffies);

and if the current time happens to be _after_ when_i_want_to_wake,
we want schedule_timeout to cope with that and do the right thing.

> Another issue I found concerns setting current task state to TASK_RUNNING
> after calling schedule_timeout(). This seems to be done in many parts of the
> kernel, though Kernel-API documentations found from kernelnewbies.org seem
> to claim that task state is guaranteed to be TASK_RUNNING after
> schedule_timeout() returns. Is the documentation faulty or does the kernel
> have obsoleted code?

The documentation is correct.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-08-20 18:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-20 17:41 schedule_timeout() Lahti Oy
2002-08-20 18:40 ` schedule_timeout() Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox