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.
This commit is contained in:
Willy Tarreau 2021-09-27 19:29:30 +02:00
parent c7e9492166
commit 8de6dc9926
3 changed files with 17 additions and 18 deletions

View File

@ -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

View File

@ -26,23 +26,6 @@
#include <haproxy/list-t.h>
#include <haproxy/thread-t.h>
/* 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

View File

@ -24,7 +24,6 @@
#include <time.h>
#include <haproxy/api-t.h>
#include <haproxy/pool-t.h>
/* thread info flags, for ha_thread_info[].flags */
#define TI_FL_STUCK 0x00000001