From 396759d4a6f66f19e9bfd10aa522422b5f4d2717 Mon Sep 17 00:00:00 2001 From: James Adams Date: Wed, 11 Sep 2024 16:45:34 +0100 Subject: [PATCH] quattor/functions/hardware: Fix thread calculation Cores is a mandatory property, so don't check if it is defined. Threads must be the sum of cores, not a count of CPUs. --- quattor/functions/hardware.pan | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/quattor/functions/hardware.pan b/quattor/functions/hardware.pan index 7cc987760..ddc21b4c0 100644 --- a/quattor/functions/hardware.pan +++ b/quattor/functions/hardware.pan @@ -41,15 +41,11 @@ function get_num_of_cores_max_threads = { 'threads', 0, ); foreach (i; cpu; hw_config['cpu']) { + result['cores'] = result['cores'] + cpu['cores']; if (is_defined(cpu['max_threads'])) { result['threads'] = result['threads'] + cpu['max_threads']; } else { - result['threads'] = result['threads'] + 1; - }; - if (is_defined(cpu['cores'])) { - result['cores'] = result['cores'] + cpu['cores']; - } else { - result['cores'] = result['cores'] + 1; + result['threads'] = result['threads'] + cpu['cores']; }; }; debug('%s: num of CPUs=%d, num of cores=%d', OBJECT, length(hw_config['cpu']), cores);