should_yield problem [Was: svn commit: r251322 - head/sys/kern]

Andriy Gapon avg at FreeBSD.org
Tue Jul 2 18:12:13 UTC 2013


on 02/07/2013 20:59 Ed Maste said the following:
> On 2 July 2013 12:48, Andriy Gapon <avg at freebsd.org> wrote:
>> I am not sure if the originally reported problem was also caused by
>> should_yield() or if it was something else.  But in either case I think that we
>> should fix should_yield.  Perhaps (ticks - curthread->td_swvoltick) should be
>> cast to unsigned before comparison?
> 
> What about just initializing td_swvoltick to ticks at td creation?

I like this idea.  Still I think that distance between two wrapping numbers
should be calculated properly even if that mostly would not matter in practice.

distance = (signed)( i1 - i2 )

-- 
Andriy Gapon


More information about the svn-src-all mailing list