]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: task: align the rq and wq locks
authorWilly Tarreau <w@1wt.eu>
Sun, 26 Nov 2017 09:19:16 +0000 (10:19 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 26 Nov 2017 10:10:51 +0000 (11:10 +0100)
We really don't want them to share the same cache line as they are
expected to be used in parallel. Adding a 64-byte alignment here shows
a performance increase of about 4.5% on task-intensive workloads with
2 to 4 threads.

src/task.c

index fbaaecee138f7e7fdbbbd11aefdc35344237cfe9..053376c3946d5154381048b3b016e621de2d6d3c 100644 (file)
@@ -40,8 +40,8 @@ unsigned int niced_tasks = 0;      /* number of niced tasks in the run queue */
 
 THREAD_LOCAL struct task *curr_task = NULL; /* task currently running or NULL */
 
-__decl_hathreads(HA_SPINLOCK_T rq_lock); /* spin lock related to run queue */
-__decl_hathreads(HA_SPINLOCK_T wq_lock); /* spin lock related to wait queue */
+__decl_hathreads(HA_SPINLOCK_T __attribute__((aligned(64))) rq_lock); /* spin lock related to run queue */
+__decl_hathreads(HA_SPINLOCK_T __attribute__((aligned(64))) wq_lock); /* spin lock related to wait queue */
 
 static struct eb_root timers;      /* sorted timers tree */
 static struct eb_root rqueue;      /* tree constituting the run queue */