From 8de6dc99260ef0f8a48b31d43c1327a210de9a13 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 27 Sep 2021 19:29:30 +0200 Subject: [PATCH] REORG: pools: move default settings to defaults.h There's no reason CONFIG_HAP_POOLS and its opposite are located into pools-t.h, it forces those that depend on them to inlcude the file. Other similar options are normally dealt with in defaults.h, which is part of the default API, so let's do that. --- include/haproxy/defaults.h | 17 +++++++++++++++++ include/haproxy/pool-t.h | 17 ----------------- include/haproxy/tinfo-t.h | 1 - 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/include/haproxy/defaults.h b/include/haproxy/defaults.h index 19a9cb6..7547a17 100644 --- a/include/haproxy/defaults.h +++ b/include/haproxy/defaults.h @@ -359,6 +359,23 @@ #define MEM_USABLE_RATIO 0.97 #endif +/* Pools are always enabled unless explicitly disabled. When disabled, the + * calls are directly passed to the underlying OS functions. + */ +#if !defined(DEBUG_NO_POOLS) && !defined(DEBUG_UAF) && !defined(DEBUG_FAIL_ALLOC) +#define CONFIG_HAP_POOLS +#endif + +/* On modern architectures with many threads, a fast memory allocator, and + * local pools, the global pools with their single list can be way slower than + * the standard allocator which already has its own per-thread arenas. In this + * case we disable global pools. The global pools may still be enforced + * using CONFIG_HAP_GLOBAL_POOLS though. + */ +#if defined(USE_THREAD) && defined(HA_HAVE_FAST_MALLOC) && !defined(CONFIG_HAP_GLOBAL_POOLS) +#define CONFIG_HAP_NO_GLOBAL_POOLS +#endif + /* default per-thread pool cache size when enabled */ #ifndef CONFIG_HAP_POOL_CACHE_SIZE #define CONFIG_HAP_POOL_CACHE_SIZE 1048576 diff --git a/include/haproxy/pool-t.h b/include/haproxy/pool-t.h index a1aba4a..c33ffc7 100644 --- a/include/haproxy/pool-t.h +++ b/include/haproxy/pool-t.h @@ -26,23 +26,6 @@ #include #include -/* Pools are always enabled unless explicitly disabled. When disabled, the - * calls are directly passed to the underlying OS functions. - */ -#if !defined(DEBUG_NO_POOLS) && !defined(DEBUG_UAF) && !defined(DEBUG_FAIL_ALLOC) -#define CONFIG_HAP_POOLS -#endif - -/* On modern architectures with many threads, a fast memory allocator, and - * local pools, the global pools with their single list can be way slower than - * the standard allocator which already has its own per-thread arenas. In this - * case we disable global pools. The global pools may still be enforced - * using CONFIG_HAP_GLOBAL_POOLS though. - */ -#if defined(USE_THREAD) && defined(HA_HAVE_FAST_MALLOC) && !defined(CONFIG_HAP_GLOBAL_POOLS) -#define CONFIG_HAP_NO_GLOBAL_POOLS -#endif - #define MEM_F_SHARED 0x1 #define MEM_F_EXACT 0x2 diff --git a/include/haproxy/tinfo-t.h b/include/haproxy/tinfo-t.h index 1285c73..4ed042f 100644 --- a/include/haproxy/tinfo-t.h +++ b/include/haproxy/tinfo-t.h @@ -24,7 +24,6 @@ #include #include -#include /* thread info flags, for ha_thread_info[].flags */ #define TI_FL_STUCK 0x00000001 -- 1.7.10.4