mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-18 19:56:59 +00:00
MINOR: pools: switch DEBUG_DONT_SHARE_POOLS to runtime
This test used to appear at a single location in create_pool() to enable a check on the pool name or unconditionally merge similarly sized pools. This patch introduces POOL_DBG_DONT_MERGE and conditions the test on this new runtime flag, that is preset according to the aforementioned debugging option.
This commit is contained in:
parent
8d0273ed88
commit
fd8b737e2c
@ -42,6 +42,7 @@
|
||||
|
||||
/* pool debugging flags */
|
||||
#define POOL_DBG_FAIL_ALLOC 0x00000001 // randomly fail memory allocations
|
||||
#define POOL_DBG_DONT_MERGE 0x00000002 // do not merge same-size pools
|
||||
|
||||
|
||||
/* This is the head of a thread-local cache */
|
||||
|
11
src/pool.c
11
src/pool.c
@ -40,6 +40,9 @@ int mem_poison_byte __read_mostly = -1;
|
||||
uint pool_debugging __read_mostly = /* set of POOL_DBG_* flags */
|
||||
#ifdef DEBUG_FAIL_ALLOC
|
||||
POOL_DBG_FAIL_ALLOC |
|
||||
#endif
|
||||
#ifdef DEBUG_DONT_SHARE_POOLS
|
||||
POOL_DBG_DONT_MERGE |
|
||||
#endif
|
||||
0;
|
||||
|
||||
@ -214,11 +217,9 @@ struct pool_head *create_pool(char *name, unsigned int size, unsigned int flags)
|
||||
* we look for a shareable one or for the next position
|
||||
* before which we will insert a new one.
|
||||
*/
|
||||
if ((flags & entry->flags & MEM_F_SHARED)
|
||||
#ifdef DEBUG_DONT_SHARE_POOLS
|
||||
&& strcmp(name, entry->name) == 0
|
||||
#endif
|
||||
) {
|
||||
if ((flags & entry->flags & MEM_F_SHARED) &&
|
||||
(!(pool_debugging & POOL_DBG_DONT_MERGE) ||
|
||||
strcmp(name, entry->name) == 0)) {
|
||||
/* we can share this one */
|
||||
pool = entry;
|
||||
DPRINTF(stderr, "Sharing %s with %s\n", name, pool->name);
|
||||
|
Loading…
Reference in New Issue
Block a user