]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: memory: Only init the pool spinlock once.
authorOlivier Houchard <cognet@ci0.org>
Sat, 1 Feb 2020 16:45:32 +0000 (17:45 +0100)
committerOlivier Houchard <cognet@ci0.org>
Sat, 1 Feb 2020 17:08:34 +0000 (18:08 +0100)
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

index 24d709f1d4a35dbe1fac922a21dd2e75277256aa..adc293874c2712c51e710cd22753490c7fdbec5d 100644 (file)
@@ -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;
 }