From bd7472399998e72b561636463b87f48435de2d94 Mon Sep 17 00:00:00 2001 From: Josiah VanderZee Date: Tue, 20 Jun 2023 06:50:14 -0500 Subject: [PATCH 1/2] Add max thread count options to CMake build This adds an option that defaults to 4096: TS_MAX_EVENT_THREADS, and an option that defaults to 3072: TS_MAX_THREADS_PER_TYPE. --- CMakeLists.txt | 12 ++++++++++++ include/tscore/ink_config.h.cmake.in | 2 ++ 2 files changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 765cdbeb665..0f2d1bc1eb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,18 @@ option(ENABLE_TCMALLOC "Use TCMalloc (default OFF)") option(ENABLE_UNWIND "Use libunwind if found on system (default ON)" ON) option(ENABLE_WCCP "Use WCCP v2 (default OFF)") set(TS_MAX_HOST_NAME_LEN 256 CACHE STRING "Max host name length (default 256)") +set(TS_MAX_EVENT_THREADS + 4096 + CACHE + STRING + "Max number of event threads (default 4096)" +) +set(TS_MAX_THREADS_PER_TYPE + 3072 + CACHE + STRING + "Max number of threads per event type (default 3072)" +) set(TS_USE_SET_RBIO 1 CACHE STRING "Use openssl set_rbio (default 1)") set(TS_USE_DIAGS 1 CACHE STRING "Use diags (default 1)") option(TS_USE_HWLOC "Use hwloc (default OFF)") diff --git a/include/tscore/ink_config.h.cmake.in b/include/tscore/ink_config.h.cmake.in index 3075dc43f47..24e4887c90c 100644 --- a/include/tscore/ink_config.h.cmake.in +++ b/include/tscore/ink_config.h.cmake.in @@ -108,6 +108,8 @@ /* Build definitions */ const int DEFAULT_STACKSIZE = @DEFAULT_STACK_SIZE@; #define TS_MAX_HOST_NAME_LEN @TS_MAX_HOST_NAME_LEN@ +#define TS_MAX_NUMBER_EVENT_THREADS @TS_MAX_EVENT_THREADS@ +#define TS_MAX_THREADS_IN_EACH_THREAD_TYPE @TS_MAX_THREADS_PER_TYPE@ /* Feature Flags */ #cmakedefine01 TS_HAS_128BIT_CAS From e6efb6f80f9f68616d575d27a8817955b5fbad20 Mon Sep 17 00:00:00 2001 From: Josiah VanderZee Date: Tue, 20 Jun 2023 13:08:56 -0500 Subject: [PATCH 2/2] Rename options to keep vars/defines consistent This renames the options by removing the TS_ prefix to make it clear they are options, and uses the TS_ for internal variables of the same name as the defines that are set to the option values. --- CMakeLists.txt | 6 ++++-- include/tscore/ink_config.h.cmake.in | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f2d1bc1eb8..52b37774644 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,13 +51,13 @@ option(ENABLE_TCMALLOC "Use TCMalloc (default OFF)") option(ENABLE_UNWIND "Use libunwind if found on system (default ON)" ON) option(ENABLE_WCCP "Use WCCP v2 (default OFF)") set(TS_MAX_HOST_NAME_LEN 256 CACHE STRING "Max host name length (default 256)") -set(TS_MAX_EVENT_THREADS +set(MAX_EVENT_THREADS 4096 CACHE STRING "Max number of event threads (default 4096)" ) -set(TS_MAX_THREADS_PER_TYPE +set(MAX_THREADS_PER_TYPE 3072 CACHE STRING @@ -78,6 +78,8 @@ set(TS_VERSION_STRING TS_VERSION_S) set(TS_VERSION_NUMBER TS_VERSION_N) set(TS_HAS_WCCP ${ENABLE_WCCP}) +set(TS_MAX_NUMBER_EVENT_THREADS ${MAX_EVENT_THREADS}) +set(TS_MAX_THREADS_IN_EACH_THREAD_TYPE ${MAX_THREADS_PER_TYPE}) # Check include files diff --git a/include/tscore/ink_config.h.cmake.in b/include/tscore/ink_config.h.cmake.in index 24e4887c90c..2d3e9ea4f29 100644 --- a/include/tscore/ink_config.h.cmake.in +++ b/include/tscore/ink_config.h.cmake.in @@ -108,8 +108,8 @@ /* Build definitions */ const int DEFAULT_STACKSIZE = @DEFAULT_STACK_SIZE@; #define TS_MAX_HOST_NAME_LEN @TS_MAX_HOST_NAME_LEN@ -#define TS_MAX_NUMBER_EVENT_THREADS @TS_MAX_EVENT_THREADS@ -#define TS_MAX_THREADS_IN_EACH_THREAD_TYPE @TS_MAX_THREADS_PER_TYPE@ +#define TS_MAX_NUMBER_EVENT_THREADS @TS_MAX_NUMBER_EVENT_THREADS@ +#define TS_MAX_THREADS_IN_EACH_THREAD_TYPE @TS_MAX_THREADS_IN_EACH_THREAD_TYPE@ /* Feature Flags */ #cmakedefine01 TS_HAS_128BIT_CAS