postgresql/src/backend/port
Thomas Munro 46201d603f Pad semaphores to avoid false sharing.
In a USE_UNNAMED_SEMAPHORES build, the default on Linux and FreeBSD
since commit ecb0d20a, we have an array of sem_t objects.  This
turned out to reduce performance compared to the previous default
USE_SYSV_SEMAPHORES on an 8 socket system.  Testing showed that the
lost performance could be regained by padding the array elements so
that they have their own cache lines.  This matches what we do for
similar hot arrays (see LWLockPadded, WALInsertLockPadded).

Back-patch to 10, where unnamed semaphores were adopted as the default
semaphore interface on those operating systems.

Author: Thomas Munro
Reviewed-by: Andres Freund
Reported-by: Mithun Cy
Tested-by: Mithun Cy, Tom Lane, Thomas Munro
Discussion: https://postgr.es/m/CAD__OugYDM3O%2BdyZnnZSbJprSfsGFJcQ1R%3De59T3hcLmDug4_w%40mail.gmail.com
2018-07-25 11:00:53 +12:00
..
aix Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
dynloader Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
hpux Redefine Datum as uintptr_t, instead of unsigned long. 2009-12-31 19:41:37 +00:00
tas Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
win32 Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
.gitignore Combine win32 and unix latch implementations. 2016-03-21 11:03:26 +01:00
atomics.c Fix and improve pg_atomic_flag fallback implementation. 2018-04-06 20:01:44 -07:00
Makefile Remove obsolete replacement system() on darwin 2016-08-18 12:00:00 -04:00
posix_sema.c Pad semaphores to avoid false sharing. 2018-07-25 11:00:53 +12:00
sysv_sema.c Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
sysv_shmem.c Change pg_ctl to detect server-ready by watching status in postmaster.pid. 2017-06-28 17:31:32 -04:00
win32_sema.c Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
win32_shmem.c Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00