kernel/scheduler: Add missing initializations to ThreadData::_InitBase().
fQuantumStart and fLastInterruptTime were not set to 0 here, so they would default to the "malloc-cleared" data and then always overflow the first time the interrupt time was tracked. I can't find any reason that was supposed to be the behavior, so just set them to 0. Also reorder the field initializations to be the same as the class definition, which should allow some store merging optimizations. Spotted by KUBSAN.
This commit is contained in:
@@ -18,23 +18,27 @@ static bigtime_t sMaximumQuantumLengths[kMaximumQuantumLengthsCount];
|
||||
void
|
||||
ThreadData::_InitBase()
|
||||
{
|
||||
fPriorityPenalty = 0;
|
||||
fAdditionalPenalty = 0;
|
||||
fEffectivePriority = GetPriority();
|
||||
fBaseQuantum = sQuantumLengths[GetEffectivePriority()];
|
||||
|
||||
fTimeUsed = 0;
|
||||
fStolenTime = 0;
|
||||
|
||||
fMeasureAvailableActiveTime = 0;
|
||||
fLastMeasureAvailableTime = 0;
|
||||
fMeasureAvailableTime = 0;
|
||||
fQuantumStart = 0;
|
||||
fLastInterruptTime = 0;
|
||||
|
||||
fWentSleep = 0;
|
||||
fWentSleepActive = 0;
|
||||
|
||||
fEnqueued = false;
|
||||
fReady = false;
|
||||
|
||||
fPriorityPenalty = 0;
|
||||
fAdditionalPenalty = 0;
|
||||
|
||||
fEffectivePriority = GetPriority();
|
||||
fBaseQuantum = sQuantumLengths[GetEffectivePriority()];
|
||||
|
||||
fTimeUsed = 0;
|
||||
|
||||
fMeasureAvailableActiveTime = 0;
|
||||
fLastMeasureAvailableTime = 0;
|
||||
fMeasureAvailableTime = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user