mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-23 06:41:32 +02: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 */
|
/* pool debugging flags */
|
||||||
#define POOL_DBG_FAIL_ALLOC 0x00000001 // randomly fail memory allocations
|
#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 */
|
/* 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 */
|
uint pool_debugging __read_mostly = /* set of POOL_DBG_* flags */
|
||||||
#ifdef DEBUG_FAIL_ALLOC
|
#ifdef DEBUG_FAIL_ALLOC
|
||||||
POOL_DBG_FAIL_ALLOC |
|
POOL_DBG_FAIL_ALLOC |
|
||||||
|
#endif
|
||||||
|
#ifdef DEBUG_DONT_SHARE_POOLS
|
||||||
|
POOL_DBG_DONT_MERGE |
|
||||||
#endif
|
#endif
|
||||||
0;
|
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
|
* we look for a shareable one or for the next position
|
||||||
* before which we will insert a new one.
|
* before which we will insert a new one.
|
||||||
*/
|
*/
|
||||||
if ((flags & entry->flags & MEM_F_SHARED)
|
if ((flags & entry->flags & MEM_F_SHARED) &&
|
||||||
#ifdef DEBUG_DONT_SHARE_POOLS
|
(!(pool_debugging & POOL_DBG_DONT_MERGE) ||
|
||||||
&& strcmp(name, entry->name) == 0
|
strcmp(name, entry->name) == 0)) {
|
||||||
#endif
|
|
||||||
) {
|
|
||||||
/* we can share this one */
|
/* we can share this one */
|
||||||
pool = entry;
|
pool = entry;
|
||||||
DPRINTF(stderr, "Sharing %s with %s\n", name, pool->name);
|
DPRINTF(stderr, "Sharing %s with %s\n", name, pool->name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user