From 0c751d732a4d3a342de45b08d7186c3a0e8d7d24 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 3 Jan 2019 13:06:48 +0000 Subject: [PATCH] unbound: calculation is still suboptimal #3092 On the far side of the interval up to the next power of two the lock contention increases drastically, meaning 31 threads will only get 32 slabs etc. --- src/etc/inc/plugins.inc.d/unbound.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/etc/inc/plugins.inc.d/unbound.inc b/src/etc/inc/plugins.inc.d/unbound.inc index 0ddf8b052..f76743617 100644 --- a/src/etc/inc/plugins.inc.d/unbound.inc +++ b/src/etc/inc/plugins.inc.d/unbound.inc @@ -86,7 +86,7 @@ function unbound_optimization() $numprocs = intval(get_single_sysctl('kern.smp.cpus')); $numprocs = $numprocs <= 0 ? 1 : $numprocs; - $numslabs = pow(2, ceil(log($numprocs, 2))); + $numslabs = pow(2, floor(log($numprocs, 2)) + 1); $optimization['number_threads'] = "num-threads: {$numprocs}"; $optimization['msg_cache_slabs'] = "msg-cache-slabs: {$numslabs}";