mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-22 02:46:50 +00:00
MINOR: pools: enable the fault injector in all allocation modes
The mem_should_fail() call enabled by DEBUG_FAIL_ALLOC used to be placed only in the no-cache version of the allocator. Now we can generalize it to all modes and remove the exclusive test on CONFIG_HAP_NO_GLOBAL_POOLS.
This commit is contained in:
parent
2d6f628d34
commit
53a7fe49aa
@ -46,7 +46,7 @@
|
|||||||
* case we disable global pools. The global pools may still be enforced
|
* case we disable global pools. The global pools may still be enforced
|
||||||
* using CONFIG_HAP_GLOBAL_POOLS though.
|
* using CONFIG_HAP_GLOBAL_POOLS though.
|
||||||
*/
|
*/
|
||||||
#if defined(USE_THREAD) && defined(HA_HAVE_FAST_MALLOC) && defined(CONFIG_HAP_POOLS) && !defined(CONFIG_HAP_GLOBAL_POOLS)
|
#if defined(USE_THREAD) && defined(HA_HAVE_FAST_MALLOC) && !defined(CONFIG_HAP_GLOBAL_POOLS)
|
||||||
#define CONFIG_HAP_NO_GLOBAL_POOLS
|
#define CONFIG_HAP_NO_GLOBAL_POOLS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -156,6 +156,10 @@ void *__pool_refill_alloc(struct pool_head *pool, unsigned int avail)
|
|||||||
int limit = pool->limit;
|
int limit = pool->limit;
|
||||||
void *ptr = NULL;
|
void *ptr = NULL;
|
||||||
|
|
||||||
|
#ifdef DEBUG_FAIL_ALLOC
|
||||||
|
if (mem_should_fail(pool))
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
if (limit && allocated >= limit) {
|
if (limit && allocated >= limit) {
|
||||||
activity[tid].pool_fail++;
|
activity[tid].pool_fail++;
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -218,6 +222,10 @@ void *__pool_refill_alloc(struct pool_head *pool, unsigned int avail)
|
|||||||
int limit = pool->limit;
|
int limit = pool->limit;
|
||||||
int allocated = pool->allocated, allocated_orig = allocated;
|
int allocated = pool->allocated, allocated_orig = allocated;
|
||||||
|
|
||||||
|
#ifdef DEBUG_FAIL_ALLOC
|
||||||
|
if (mem_should_fail(pool))
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
/* stop point */
|
/* stop point */
|
||||||
avail += pool->used;
|
avail += pool->used;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user