[PATCH v5] introduce macro spin_event_timeout()

Roland Dreier rdreier at cisco.com
Wed Mar 11 16:09:59 EST 2009


 > Alan did have one valid point though.  Determining how long to loop
 > for is architecture-specific.  Using jiffies is bad, because even one
 > jiffy is too long.  Adding a udelay() inside the loop means that it
 > only checks he condition every microsecond.  So the real solution is
 > to use keep looping until a certain amount of time has passed.  This
 > means using an architecture-specific timebase register.

Are there really cases where spinning for 1 jiffy is too long of a
timeout?  It might make sense for the parameter passed in to be in terms
of microseconds but I have a hard time coming up with a case where
having the real timeout be 40 msecs or whatever 1 jiffy ends up being is
a real problem -- after all, this helper is intended for the case where
we expect the condition to become true much sooner than the worst case.

 - R.



More information about the Linuxppc-dev mailing list