]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove unused functions from isc_thread API
authorOndřej Surý <ondrej@isc.org>
Wed, 9 Feb 2022 09:00:59 +0000 (10:00 +0100)
committerOndřej Surý <ondrej@isc.org>
Wed, 9 Feb 2022 17:09:48 +0000 (18:09 +0100)
The isc_thread_setaffinity call was removed in !5265 and we are not
going to restore it because it was proven that the performance is better
without it.  Additionally, remove the already disabled cpu system test.

The isc_thread_setconcurrency function is unused and also calling
pthread_setconcurrency() on Linux has no meaning, formerly it was
added because of Solaris in 2001 and it was removed when taskmgr was
refactored to run on top of netmgr in !4918.

(cherry picked from commit 0500345513739c97d2eb6ecd1dbd0a2ce7d0c0b4)

bin/tests/system/cpu/clean.sh [deleted file]
bin/tests/system/cpu/ns1/named.conf.in [deleted file]
bin/tests/system/cpu/prereq.sh [deleted file]
bin/tests/system/cpu/setup.sh [deleted file]
bin/tests/system/cpu/tests.sh [deleted file]
config.h.in
configure
configure.ac
lib/isc/pthreads/include/isc/thread.h
lib/isc/pthreads/thread.c

diff --git a/bin/tests/system/cpu/clean.sh b/bin/tests/system/cpu/clean.sh
deleted file mode 100644 (file)
index 4a9f12f..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-#
-# SPDX-License-Identifier: MPL-2.0
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0.  If a copy of the MPL was not distributed with this
-# file, you can obtain one at https://mozilla.org/MPL/2.0/.
-#
-# See the COPYRIGHT file distributed with this work for additional
-# information regarding copyright ownership.
-
-set -e
-
-rm -f ps.out
-rm -f ns1/named.conf ns1/managed-keys.* ns1/named.run ns1/named.memstats
diff --git a/bin/tests/system/cpu/ns1/named.conf.in b/bin/tests/system/cpu/ns1/named.conf.in
deleted file mode 100644 (file)
index 6c934b2..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * SPDX-License-Identifier: MPL-2.0
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0.  If a copy of the MPL was not distributed with this
- * file, you can obtain one at https://mozilla.org/MPL/2.0/.
- *
- * See the COPYRIGHT file distributed with this work for additional
- * information regarding copyright ownership.
- */
-
-options {
-       query-source address 10.53.0.1;
-       port @PORT@;
-       pid-file "named.pid";
-       listen-on { 10.53.0.1; };
-       listen-on-v6 { none; };
-};
diff --git a/bin/tests/system/cpu/prereq.sh b/bin/tests/system/cpu/prereq.sh
deleted file mode 100644 (file)
index 8936129..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh -e
-
-# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-#
-# SPDX-License-Identifier: MPL-2.0
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0.  If a copy of the MPL was not distributed with this
-# file, you can obtain one at https://mozilla.org/MPL/2.0/.
-#
-# See the COPYRIGHT file distributed with this work for additional
-# information regarding copyright ownership.
-
-set -e
-
-# shellcheck source=conf.sh
-. ../conf.sh
-
-case $(uname) in
-       Linux*)
-               ;;
-       *)
-               echo_i "cpu test only runs on Linux"
-               exit 255
-               ;;
-esac
-
-# TASKSET will be an empty string if no taskset program was found.
-TASKSET=$(command -v "taskset" || true)
-if ! test -x "$TASKSET" ; then
-       exit 255
-fi
-
-if ! $TASKSET fff0 true > /dev/null 2>&1; then
-        echo_i "taskset failed"
-        exit 255
-fi
diff --git a/bin/tests/system/cpu/setup.sh b/bin/tests/system/cpu/setup.sh
deleted file mode 100644 (file)
index 9676770..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh -e
-
-# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-#
-# SPDX-License-Identifier: MPL-2.0
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0.  If a copy of the MPL was not distributed with this
-# file, you can obtain one at https://mozilla.org/MPL/2.0/.
-#
-# See the COPYRIGHT file distributed with this work for additional
-# information regarding copyright ownership.
-
-# shellcheck source=conf.sh
-. ../conf.sh
-
-set -e
-
-$SHELL clean.sh
-
-copy_setports ns1/named.conf.in ns1/named.conf
diff --git a/bin/tests/system/cpu/tests.sh b/bin/tests/system/cpu/tests.sh
deleted file mode 100644 (file)
index 31031a1..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-
-# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
-#
-# SPDX-License-Identifier: MPL-2.0
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0.  If a copy of the MPL was not distributed with this
-# file, you can obtain one at https://mozilla.org/MPL/2.0/.
-#
-# See the COPYRIGHT file distributed with this work for additional
-# information regarding copyright ownership.
-
-# shellcheck source=conf.sh
-. ../conf.sh
-
-status=0
-n=0
-
-n=$((n+1))
-echo_i "stop server ($n)"
-ret=0
-$PERL ../stop.pl cpu ns1 || ret=1
-test "$ret" -eq 0 || echo_i "failed"
-status=$((status+ret))
-
-n=$((n+1))
-echo_i "start server with taskset ($n)"
-ret=0
-start_server --noclean --taskset fff0 --restart --port "${PORT}" cpu ns1 || ret=1
-test "$ret" -eq 0 || echo_i "failed"
-status=$((status+ret))
-
-n=$((n+1))
-echo_i "check ps output ($n)"
-ret=0
-ps -T -o pid,psr,time,comm -e > ps.out
-pid=$(cat ns1/named.pid)
-echo_i "pid=$pid"
-psr=$(awk -v pid="$pid" '$1 == pid && $4 == "isc-net-0000" {print $2}' < ps.out)
-echo_i "psr=$psr"
-# The next available cpu relative to the existing affinity mask is 4.
-test "$psr" -eq 4 || ret=1
-test "$ret" -eq 0 || echo_i "failed"
-status=$((status+ret))
-
-echo_i "exit status: $status"
-[ $status -eq 0 ] || exit 1
index 8840c89de4873b312d43d1f20d1c60c714dc58fa..a612225addb700ad5d65185ba7dff4b8eda8f541 100644 (file)
@@ -69,9 +69,6 @@
 /* Use CMocka */
 #undef HAVE_CMOCKA
 
-/* Define to 1 if you have the `cpuset_setaffinity' function. */
-#undef HAVE_CPUSET_SETAFFINITY
-
 /* Define to 1 if you have the `CRYPTO_zalloc' function. */
 #undef HAVE_CRYPTO_ZALLOC
 
 /* Define to 1 if you have the `OPENSSL_init_ssl' function. */
 #undef HAVE_OPENSSL_INIT_SSL
 
-/* Define to 1 if you have the `processor_bind' function. */
-#undef HAVE_PROCESSOR_BIND
-
 /* Define if you have POSIX threads libraries and header files. */
 #undef HAVE_PTHREAD
 
 /* Define to 1 if you have the `pthread_rwlock_rdlock' function. */
 #undef HAVE_PTHREAD_RWLOCK_RDLOCK
 
-/* Define to 1 if you have the `pthread_setaffinity_np' function. */
-#undef HAVE_PTHREAD_SETAFFINITY_NP
-
 /* Define to 1 if you have the `pthread_setname_np' function. */
 #undef HAVE_PTHREAD_SETNAME_NP
 
 /* Define to 1 if you have the <sched.h> header file. */
 #undef HAVE_SCHED_H
 
-/* Define to 1 if you have the `sched_setaffinity' function. */
-#undef HAVE_SCHED_SETAFFINITY
-
 /* Define to 1 if you have the `sched_yield' function. */
 #undef HAVE_SCHED_YIELD
 
 /* Define to 1 if you have the <sys/capability.h> header file. */
 #undef HAVE_SYS_CAPABILITY_H
 
-/* Define to 1 if you have the <sys/cpuset.h> header file. */
-#undef HAVE_SYS_CPUSET_H
-
 /* Define to 1 if you have the <sys/devpoll.h> header file. */
 #undef HAVE_SYS_DEVPOLL_H
 
 /* Define to 1 if you have the <sys/param.h> header file. */
 #undef HAVE_SYS_PARAM_H
 
-/* Define to 1 if you have the <sys/procset.h> header file. */
-#undef HAVE_SYS_PROCSET_H
-
 /* Define to 1 if you have the <sys/select.h> header file. */
 #undef HAVE_SYS_SELECT_H
 
index bc4657b2670455bc197f9793e9d16ff2009d0e2b..6caf22fcf38920abe8947c9f192d9bc4aded2313 100755 (executable)
--- a/configure
+++ b/configure
 done
 
 
-for ac_header in sys/cpuset.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "sys/cpuset.h" "ac_cv_header_sys_cpuset_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_cpuset_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_SYS_CPUSET_H 1
-_ACEOF
-
-fi
-
-done
-
-for ac_header in sys/procset.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "sys/procset.h" "ac_cv_header_sys_procset_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_procset_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_SYS_PROCSET_H 1
-_ACEOF
-
-fi
-
-done
-
-for ac_func in pthread_setaffinity_np cpuset_setaffinity processor_bind sched_setaffinity
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
 # Look for functions relating to thread naming
 for ac_func in pthread_setname_np pthread_set_name_np
 do :
index 79d33d10930faa3c9d90d985b2b9716d1c63ff9d..580a9da9c2f831f98a210e61e6be0edebee306b4 100644 (file)
@@ -717,10 +717,6 @@ AC_CHECK_HEADERS([sched.h])
 AC_SEARCH_LIBS([sched_yield],[rt])
 AC_CHECK_FUNCS([sched_yield pthread_yield pthread_yield_np])
 
-AC_CHECK_HEADERS([sys/cpuset.h])
-AC_CHECK_HEADERS([sys/procset.h])
-AC_CHECK_FUNCS([pthread_setaffinity_np cpuset_setaffinity processor_bind sched_setaffinity])
-
 # Look for functions relating to thread naming
 AC_CHECK_FUNCS([pthread_setname_np pthread_set_name_np])
 AC_CHECK_HEADERS([pthread_np.h], [], [], [#include <pthread.h>])
index a2df8dca3ca2b4ba316dbb8d25046d940351d653..d136e1e10b2e17e8b468f147fde65038f24a8c60 100644 (file)
@@ -45,18 +45,12 @@ isc_thread_create(isc_threadfunc_t, isc_threadarg_t, isc_thread_t *);
 void
 isc_thread_join(isc_thread_t thread, isc_threadresult_t *result);
 
-void
-isc_thread_setconcurrency(unsigned int level);
-
 void
 isc_thread_yield(void);
 
 void
 isc_thread_setname(isc_thread_t thread, const char *name);
 
-isc_result_t
-isc_thread_setaffinity(int cpu);
-
 #define isc_thread_self (uintptr_t) pthread_self
 
 /***
index 4e2f9af8bad5457a5426f725fb304e76c75a027b..4c7380cac1e6e8a0583e93653d4d4f2ac56bb3ab 100644 (file)
@@ -97,15 +97,6 @@ isc_thread_join(isc_thread_t thread, isc_threadresult_t *result) {
        }
 }
 
-#ifdef __NetBSD__
-#define pthread_setconcurrency(a) (void)a /* nothing */
-#endif                                   /* ifdef __NetBSD__ */
-
-void
-isc_thread_setconcurrency(unsigned int level) {
-       (void)pthread_setconcurrency(level);
-}
-
 void
 isc_thread_setname(isc_thread_t thread, const char *name) {
 #if defined(HAVE_PTHREAD_SETNAME_NP) && !defined(__APPLE__)
@@ -136,99 +127,3 @@ isc_thread_yield(void) {
        pthread_yield_np();
 #endif /* if defined(HAVE_SCHED_YIELD) */
 }
-
-#if defined(HAVE_CPUSET_SETAFFINITY) || defined(HAVE_PTHREAD_SETAFFINITY_NP)
-#if defined(HAVE_CPUSET_SETAFFINITY)
-static int
-getaffinity(cpuset_t *set) {
-       return (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1,
-                                  sizeof(*set), set));
-}
-static int
-issetaffinity(int cpu, cpuset_t *set) {
-       return ((cpu >= CPU_SETSIZE) ? -1 : CPU_ISSET(cpu, set) ? 1 : 0);
-}
-static int
-setaffinity(int cpu, cpuset_t *set) {
-       CPU_ZERO(set);
-       CPU_SET(cpu, set);
-       return (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1,
-                                  sizeof(*set), set));
-}
-#elif defined(__NetBSD__)
-static int
-getaffinity(cpuset_t *set) {
-       return (pthread_getaffinity_np(pthread_self(), cpuset_size(set), set));
-}
-static int
-issetaffinity(int cpu, cpuset_t *set) {
-       return (cpuset_isset(cpu, set));
-}
-static int
-setaffinity(int cpu, cpuset_t *set) {
-       cpuset_zero(set);
-       cpuset_set(cpu, set);
-       return (pthread_setaffinity_np(pthread_self(), cpuset_size(set), set));
-}
-#else /* linux ? */
-static int
-getaffinity(cpu_set_t *set) {
-       return (pthread_getaffinity_np(pthread_self(), sizeof(*set), set));
-}
-static int
-issetaffinity(int cpu, cpu_set_t *set) {
-       return ((cpu >= CPU_SETSIZE) ? -1 : CPU_ISSET(cpu, set) ? 1 : 0);
-}
-static int
-setaffinity(int cpu, cpu_set_t *set) {
-       CPU_ZERO(set);
-       CPU_SET(cpu, set);
-       return (pthread_setaffinity_np(pthread_self(), sizeof(*set), set));
-}
-#endif
-#endif
-
-isc_result_t
-isc_thread_setaffinity(int cpu) {
-#if defined(HAVE_CPUSET_SETAFFINITY) || defined(HAVE_PTHREAD_SETAFFINITY_NP)
-       int cpu_id = -1, cpu_aff_ok_counter = -1, n;
-#if defined(HAVE_CPUSET_SETAFFINITY)
-       cpuset_t _set, *set = &_set;
-#define cpuset_destroy(x) ((void)0)
-#elif defined(__NetBSD__)
-       cpuset_t *set = cpuset_create();
-       if (set == NULL) {
-               return (ISC_R_FAILURE);
-       }
-#else /* linux? */
-       cpu_set_t _set, *set = &_set;
-#define cpuset_destroy(x) ((void)0)
-#endif
-
-       if (getaffinity(set) != 0) {
-               cpuset_destroy(set);
-               return (ISC_R_FAILURE);
-       }
-       while (cpu_aff_ok_counter < cpu) {
-               cpu_id++;
-               if ((n = issetaffinity(cpu_id, set)) > 0) {
-                       cpu_aff_ok_counter++;
-               } else if (n < 0) {
-                       cpuset_destroy(set);
-                       return (ISC_R_FAILURE);
-               }
-       }
-       if (setaffinity(cpu_id, set) != 0) {
-               cpuset_destroy(set);
-               return (ISC_R_FAILURE);
-       }
-       cpuset_destroy(set);
-#elif defined(HAVE_PROCESSOR_BIND)
-       if (processor_bind(P_LWPID, P_MYID, cpu, NULL) != 0) {
-               return (ISC_R_FAILURE);
-       }
-#else  /* if defined(HAVE_CPUSET_SETAFFINITY) */
-       UNUSED(cpu);
-#endif /* if defined(HAVE_CPUSET_SETAFFINITY) */
-       return (ISC_R_SUCCESS);
-}