From: Olivier Houchard Date: Sat, 1 Feb 2020 16:45:32 +0000 (+0100) Subject: MINOR: memory: Only init the pool spinlock once. X-Git-Tag: v2.2-dev2~46 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8af97eb4a19c1d3c0849b5e5e5d350d63f819032;p=thirdparty%2Fhaproxy.git MINOR: memory: Only init the pool spinlock once. In pool_create(), only initialize the pool spinlock if we just created the pool, in the event we're reusing it, there's no need to initialize it again. --- diff --git a/src/memory.c b/src/memory.c index 24d709f1d4..adc293874c 100644 --- a/src/memory.c +++ b/src/memory.c @@ -139,11 +139,11 @@ struct pool_head *create_pool(char *name, unsigned int size, unsigned int flags) for (thr = 0; thr < MAX_THREADS; thr++) pool_cache[thr][idx].size = size; } - } - pool->users++; #ifndef CONFIG_HAP_LOCKLESS_POOLS - HA_SPIN_INIT(&pool->lock); + HA_SPIN_INIT(&pool->lock); #endif + } + pool->users++; return pool; }