From: Willy Tarreau Date: Sun, 26 Nov 2017 09:41:47 +0000 (+0100) Subject: CLEANUP: fd: place the lock at the beginning of struct fdtab X-Git-Tag: v1.8.0~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5809052ae1066b0af9d36ae63608621f75d260f6;p=thirdparty%2Fhaproxy.git CLEANUP: fd: place the lock at the beginning of struct fdtab The struct is not cache line aligned but at least, every time the lock will appear in the same cache line as the fd it will benefit from being accessed first. This improves the performance by about 2% on fd-intensive workloads with 4 threads. --- diff --git a/include/types/fd.h b/include/types/fd.h index 2d8237ba18..032bab967b 100644 --- a/include/types/fd.h +++ b/include/types/fd.h @@ -92,10 +92,10 @@ enum fd_states { /* info about one given fd */ struct fdtab { + __decl_hathreads(HA_SPINLOCK_T lock); + unsigned long thread_mask; /* mask of thread IDs authorized to process the task */ void (*iocb)(int fd); /* I/O handler */ void *owner; /* the connection or listener associated with this fd, NULL if closed */ - unsigned long thread_mask; /* mask of thread IDs authorized to process the task */ - __decl_hathreads(HA_SPINLOCK_T lock); unsigned int cache; /* position+1 in the FD cache. 0=not in cache. */ unsigned char state; /* FD state for read and write directions (2*3 bits) */ unsigned char ev; /* event seen in return of poll() : FD_POLL_* */