scheduler: system_time() may be unreliable

On multisocket systems as well as under virtual machines logical CPUs
may use separate TSC. We could attempt to synchronize them what probably
would solve problems on multisocket systems. Unfortunately, when running
under hypervisor there is still a chance that TSC will get out of sync
again (e.g. cpufreq enabled on host when there is no invariant TSC). As
long as we use RDTSC as our main time source the scheduler must accept the
fact that time may go backwards (what isn't really a serious problem).
This commit is contained in:
Pawel Dziepak
2014-01-20 03:22:04 +01:00
parent 73db12ab31
commit 59b9b52aaf
@@ -394,8 +394,7 @@ ThreadData::Enqueue()
SCHEDULER_ENTER_FUNCTION();
if (!fReady) {
ASSERT(system_time() - fWentSleep >= 0);
if (gTrackCoreLoad) {
if (gTrackCoreLoad && system_time() - fWentSleep > 0) {
fMeasureAvailableTime += system_time() - fWentSleep;
fCore->UpdateLoad(fNeededLoad);