mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-05 19:53:38 +02:00
MINOR: pools: rename CONFIG_HAP_LOCAL_POOLS to CONFIG_HAP_POOLS
We're going to make the local pool always present unless pools are completely disabled. This means that pools are always enabled by default, regardless of the use of threads. Let's drop this notion of "local" pools and make it just "pool". The equivalent debug option becomes DEBUG_NO_POOLS instead of DEBUG_NO_LOCAL_POOLS. For now this changes nothing except the option and dropping the dependency on USE_THREAD.
This commit is contained in:
@@ -26,6 +26,13 @@
|
||||
#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 architectures supporting threads and double-word CAS, we can implement
|
||||
* lock-less memory pools. This isn't supported for debugging modes however.
|
||||
*/
|
||||
@@ -33,20 +40,13 @@
|
||||
#define CONFIG_HAP_LOCKLESS_POOLS
|
||||
#endif
|
||||
|
||||
/* On architectures supporting threads we can amortize the locking cost using
|
||||
* local pools.
|
||||
*/
|
||||
#if defined(USE_THREAD) && !defined(DEBUG_NO_LOCAL_POOLS) && !defined(DEBUG_UAF) && !defined(DEBUG_FAIL_ALLOC)
|
||||
#define CONFIG_HAP_LOCAL_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_LOCAL_POOLS) && !defined(CONFIG_HAP_GLOBAL_POOLS)
|
||||
#if defined(USE_THREAD) && defined(HA_HAVE_FAST_MALLOC) && defined(CONFIG_HAP_POOLS) && !defined(CONFIG_HAP_GLOBAL_POOLS)
|
||||
#define CONFIG_HAP_NO_GLOBAL_POOLS
|
||||
#endif
|
||||
|
||||
@@ -117,7 +117,7 @@ struct pool_head {
|
||||
unsigned int failed; /* failed allocations */
|
||||
struct list list; /* list of all known pools */
|
||||
char name[12]; /* name of the pool */
|
||||
#ifdef CONFIG_HAP_LOCAL_POOLS
|
||||
#ifdef CONFIG_HAP_POOLS
|
||||
struct pool_cache_head cache[MAX_THREADS]; /* pool caches */
|
||||
#endif
|
||||
} __attribute__((aligned(64)));
|
||||
|
||||
@@ -71,7 +71,7 @@ static inline int pool_is_crowded(const struct pool_head *pool)
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_HAP_LOCAL_POOLS
|
||||
#ifdef CONFIG_HAP_POOLS
|
||||
|
||||
/****************** Thread-local cache management ******************/
|
||||
|
||||
@@ -123,7 +123,7 @@ static inline void pool_put_to_cache(struct pool_head *pool, void *ptr)
|
||||
pool_evict_from_cache();
|
||||
}
|
||||
|
||||
#endif // CONFIG_HAP_LOCAL_POOLS
|
||||
#endif // CONFIG_HAP_POOLS
|
||||
|
||||
|
||||
#if defined(CONFIG_HAP_NO_GLOBAL_POOLS)
|
||||
@@ -269,7 +269,7 @@ static inline void *__pool_alloc(struct pool_head *pool, unsigned int flags)
|
||||
{
|
||||
void *p;
|
||||
|
||||
#ifdef CONFIG_HAP_LOCAL_POOLS
|
||||
#ifdef CONFIG_HAP_POOLS
|
||||
if (likely(p = __pool_get_from_cache(pool)))
|
||||
goto ret;
|
||||
#endif
|
||||
@@ -330,7 +330,7 @@ static inline void pool_free(struct pool_head *pool, void *ptr)
|
||||
if (unlikely(mem_poison_byte >= 0))
|
||||
memset(ptr, mem_poison_byte, pool->size);
|
||||
|
||||
#ifdef CONFIG_HAP_LOCAL_POOLS
|
||||
#ifdef CONFIG_HAP_POOLS
|
||||
/* put the object back into the cache only if there are not too
|
||||
* many objects yet in this pool (no more than half of the cached
|
||||
* is used or this pool uses no more than 1/8 of the cache size).
|
||||
|
||||
@@ -42,7 +42,7 @@ struct thread_info {
|
||||
unsigned int idle_pct; /* idle to total ratio over last sample (percent) */
|
||||
unsigned int flags; /* thread info flags, TI_FL_* */
|
||||
|
||||
#ifdef CONFIG_HAP_LOCAL_POOLS
|
||||
#ifdef CONFIG_HAP_POOLS
|
||||
struct list pool_lru_head; /* oldest objects */
|
||||
#endif
|
||||
struct list buffer_wq; /* buffer waiters */
|
||||
|
||||
Reference in New Issue
Block a user