[openib-general] Re: [KJ] [RFC] TODO file cleanups

Nishanth Aravamudan nacc at us.ibm.com
Tue Jan 18 09:45:43 PST 2005


On Tue, Jan 18, 2005 at 09:19:40AM -0800, Roland Dreier wrote:
>     Matthew> Funny you should mention that.
> 
>     Matthew> drivers/infiniband/ulp/ipoib/ipoib_ib.c: yield();
>     Matthew> drivers/infiniband/ulp/ipoib/ipoib_ib.c: yield();
> 
>     Matthew> *SLAP*.
> 
> ouch ;)
> 
> What should those uses of yield() be replaced with?  The loops are
> polling for pending work to finish up on an exit path, and don't have
> any strict timing requirements.  cond_resched() seems a bit
> heavyweight, since we don't need to run for our whole time slice.  We
> could do msleep(0) or msleep(1) but I don't quite see why that's much
> of an improvement.

I'm not an expert by any means, but I would *really* appreciate it if you would
not call msleep(0). Just because the function currently has the odd behavior of
sleeping for an extra jiffy, I don't want anyone to get the idea to call
msleep(0) in their drivers! :) It just seems misleading. Call msleep(1) if you
are ok with a millisecond delay (or longer). Currently it will sleep for a
millisecond + 1 jiffy, but hopefully we will eventually be able to implement
accurate delays, in which case it is most important that the intent of the
author (IMO masked by msleep(0)) be clear.

Thanks,
Nish



More information about the general mailing list