From 8af97eb4a19c1d3c0849b5e5e5d350d63f819032 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Sat, 1 Feb 2020 17:45:32 +0100 Subject: [PATCH] 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. --- src/memory.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/memory.c b/src/memory.c index 24d709f1d..adc293874 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; } +#ifndef CONFIG_HAP_LOCKLESS_POOLS + HA_SPIN_INIT(&pool->lock); +#endif } pool->users++; -#ifndef CONFIG_HAP_LOCKLESS_POOLS - HA_SPIN_INIT(&pool->lock); -#endif return pool; }