mirror of
https://github.com/facebook/zstd
synced 2026-08-22 22:32:07 -04:00
Only set numPhysicalCores if ratio is valid
This commit is contained in:
parent
eb1a09df61
commit
4d6c78fb89
1 changed files with 4 additions and 2 deletions
|
|
@ -1212,11 +1212,13 @@ int UTIL_countPhysicalCores(void)
|
|||
/* fall back on the sysconf value */
|
||||
goto failed;
|
||||
} }
|
||||
if (siblings && cpu_cores) {
|
||||
if (siblings && cpu_cores && siblings > cpu_cores) {
|
||||
ratio = siblings / cpu_cores;
|
||||
}
|
||||
|
||||
numPhysicalCores = numPhysicalCores / ratio;
|
||||
if (ratio && numPhysicalCores > ratio) {
|
||||
numPhysicalCores = numPhysicalCores / ratio;
|
||||
}
|
||||
|
||||
failed:
|
||||
fclose(cpuinfo);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue