From 150160782ce36713f6646937dfe088f50b6b6fca Mon Sep 17 00:00:00 2001 From: Nightfeather Date: Mon, 12 Sep 2022 10:14:52 +0800 Subject: [PATCH] Detect cores actual present. according to man page of sysconf, _SC_NPROCESSORS_CONF will report core count that kernel ready to setup (including cores not enabled/hot-plugged in), which may report more than actual exist. use _SC_NPROCESSORS_ONLN instead. --- amdctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amdctl.c b/amdctl.c index b524733..249469f 100644 --- a/amdctl.c +++ b/amdctl.c @@ -197,7 +197,7 @@ void getCpuInfo() { } // Check for dual or quad CPU motherboards. - unsigned short testcores = (unsigned short) sysconf(_SC_NPROCESSORS_CONF); + unsigned short testcores = (unsigned short) sysconf(_SC_NPROCESSORS_ONLN); if (testcores > cores) { if (!quiet) { printf("Multi-CPU motherboard detected: CPU has %d cores, but there is a total %d cores in %d CPU sockets.\n", cores, testcores, testcores / cores);