1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-04 09:09:56 +00:00

should_yield: protect from td_swvoltick being uninitialized or too stale

The distance between ticks and td_swvoltick should be calculated as
an unsigned number.  Previously we could end up comparing a negative
number with hogticks in which case should_yield() would give incorrect
answer.

We should probably ensure that td_swvoltick is properly initialized.

Sponsored by:	HybridCluster
MFC after:	5 days
This commit is contained in:
Andriy Gapon 2013-07-09 09:01:44 +00:00
parent 9a91031836
commit d6fc869ebd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=253077

View File

@ -581,7 +581,7 @@ int
should_yield(void)
{
return (ticks - curthread->td_swvoltick >= hogticks);
return ((unsigned int)(ticks - curthread->td_swvoltick) >= hogticks);
}
void