Fixed CPU performance (#1702)

This commit is contained in:
Ilya Lavrenov 2020-08-10 15:43:25 +03:00 committed by GitHub
parent 3cc7896e42
commit 600ad8d180
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,11 +57,11 @@ bool PinThreadToVacantCore(int thrIdx, int hyperthreads, int ncores, const CpuSe
}
// Find index of 'cpu_idx'-th bit that equals to 1
int mapped_idx = 0;
int mapped_idx = -1;
while (cpu_idx >= 0) {
mapped_idx++;
if (CPU_ISSET_S(mapped_idx, size, procMask.get()))
--cpu_idx;
mapped_idx++;
}
CpuSet targetMask{CPU_ALLOC(ncores)};