Dont force single threaded VMs for AMD

This commit is contained in:
Eric Schultz
2020-02-10 04:07:54 -06:00
committed by GitHub
parent 5b8ef99c96
commit 7288145222

View File

@@ -33,12 +33,8 @@ case 'vm':
// initial cores/threads assignment
$cores = $vcpus;
$threads = 1;
$vendor = exec("grep -Pom1 '^vendor_id\\s+: \\K\\S+' /proc/cpuinfo");
if ($vendor == 'AuthenticAMD') {
$ht = 1; // force single threaded for AMD
} else {
$ht = exec("lscpu|grep -Po '^Thread\\(s\\) per core:\\s+\\K\\d+'") ?: 1; // fetch hyperthreading
}
$ht = exec("lscpu|grep -Po '^Thread\\(s\\) per core:\\s+\\K\\d+'") ?: 1; // fetch hyperthreading
// adjust for hyperthreading
if ($vcpus > $ht && $vcpus%$ht===0) {
$cores /= $ht;