From 64ab7cc7405744060ab4ac396944c007646fe3e6 Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Fri, 7 Jun 2019 01:12:04 -0300 Subject: [PATCH] OpenBSD: only get active CPU core count MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Newer computers may have some cores offline because of the Meltdown/Spectre patches from a while ago, making uv_cpu_info potentially misleading and leading to people attempting to use more threads than they actually have available. This makes it so only the cores that are online and doing any work are counted. PR-URL: https://github.com/libuv/libuv/pull/2326 Reviewed-By: Ben Noordhuis Reviewed-By: Santiago Gimeno Reviewed-By: Saúl Ibarra Corretgé Reviewed-By: Colin Ihrig --- src/unix/openbsd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/openbsd.c b/src/unix/openbsd.c index ffae7683..b5cdc80c 100644 --- a/src/unix/openbsd.c +++ b/src/unix/openbsd.c @@ -193,7 +193,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { if (sysctl(which, 2, &model, &size, NULL, 0)) return UV__ERR(errno); - which[1] = HW_NCPU; + which[1] = HW_NCPUONLINE; size = sizeof(numcpus); if (sysctl(which, 2, &numcpus, &size, NULL, 0)) return UV__ERR(errno);