]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: pools: align pools on a cache line
authorWilly Tarreau <w@1wt.eu>
Sun, 26 Nov 2017 09:50:36 +0000 (10:50 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 26 Nov 2017 10:10:53 +0000 (11:10 +0100)
There are just a few pools, and they're stressed a lot, so it makes
sense to dedicate them a cache line to avoid contention and to place
the lock at the beginning.

include/common/memory.h

index 5096125234ab5329cbfc31c7b80f33472e81b226..80078558b6237b2c69495825a18889199cdd0571 100644 (file)
@@ -48,8 +48,8 @@
 #endif
 
 struct pool_head {
-       void **free_list;
        __decl_hathreads(HA_SPINLOCK_T lock); /* the spin lock */
+       void **free_list;
        struct list list;       /* list of all known pools */
        unsigned int used;      /* how many chunks are currently in use */
        unsigned int allocated; /* how many chunks have been allocated */
@@ -60,7 +60,7 @@ struct pool_head {
        unsigned int users;     /* number of pools sharing this zone */
        unsigned int failed;    /* failed allocations */
        char name[12];          /* name of the pool */
-};
+} __attribute__((aligned(64)));
 
 /* poison each newly allocated area with this byte if >= 0 */
 extern int mem_poison_byte;