summaryrefslogtreecommitdiff
path: root/configure.cmake
diff options
context:
space:
mode:
authorDaniel Black <daniel@linux.ibm.com>2018-11-09 14:38:22 +1100
committerAnel Husakovic <anel@mariadb.org>2020-02-20 08:44:20 +0100
commitfb01cc3766be9131402b82730adfa0e45e6e3511 (patch)
treef3ef6f22014af71162a0579940f782113f6a307f /configure.cmake
parent959fc0c0ccaac0c0946a9c07bceb9b82116c8b47 (diff)
downloadmariadb-git-fb01cc3766be9131402b82730adfa0e45e6e3511.tar.gz
my_getncpus based on threads available
Detecting the cpus based on sysconf of the online CPUs can significantly over estimate the number of cpus available. Wheither via numactl, cgroups, taskset, systemd constraints, docker containers and probably other mechanisms, the number of threads mysqld can be run on can be quite less. As such we use the pthread_getaffinity_np function on Linux and FreeBSD (identical API) to get the number of CPUs. The number of CPUs is the default for the thread_pool_size and a too high default will resulting in large memory usage and high context switching overhead. Closes PR #922
Diffstat (limited to 'configure.cmake')
-rw-r--r--configure.cmake2
1 files changed, 2 insertions, 0 deletions
diff --git a/configure.cmake b/configure.cmake
index f94fb3642a5..a85652a8345 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -375,6 +375,8 @@ CHECK_FUNCTION_EXISTS (pthread_attr_setscope HAVE_PTHREAD_ATTR_SETSCOPE)
CHECK_FUNCTION_EXISTS (pthread_attr_getguardsize HAVE_PTHREAD_ATTR_GETGUARDSIZE)
CHECK_FUNCTION_EXISTS (pthread_attr_setstacksize HAVE_PTHREAD_ATTR_SETSTACKSIZE)
CHECK_FUNCTION_EXISTS (pthread_condattr_create HAVE_PTHREAD_CONDATTR_CREATE)
+CHECK_FUNCTION_EXISTS (pthread_condattr_setclock HAVE_PTHREAD_CONDATTR_SETCLOCK)
+CHECK_FUNCTION_EXISTS (pthread_getaffinity_np HAVE_PTHREAD_GETAFFINITY_NP)
CHECK_FUNCTION_EXISTS (pthread_key_delete HAVE_PTHREAD_KEY_DELETE)
CHECK_FUNCTION_EXISTS (pthread_rwlock_rdlock HAVE_PTHREAD_RWLOCK_RDLOCK)
CHECK_FUNCTION_EXISTS (pthread_sigmask HAVE_PTHREAD_SIGMASK)