mirror of
https://github.com/postgres/postgres.git
synced 2025-08-24 09:27:52 +03:00
Keep heavily-contended fields in XLogCtlInsert on different cache lines.
Performance testing shows that if the insertpos_lck spinlock and the fields that it protects are on the same cache line with other variables that are frequently accessed, the false sharing can hurt performance a lot. Keep them apart by adding some padding.
This commit is contained in:
@@ -199,6 +199,17 @@
|
||||
#define USE_PPC_LWSYNC
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Assumed cache line size. This doesn't affect correctness, but can be
|
||||
* used for low-level optimizations. Currently, this is only used to pad
|
||||
* some data structures in xlog.c, to ensure that highly-contended fields
|
||||
* are on different cache lines. Too small a value can hurt performance due
|
||||
* to false sharing, while the only downside of too large a value is a few
|
||||
* bytes of wasted memory. The default is 128, which should be large enough
|
||||
* for all supported platforms.
|
||||
*/
|
||||
#define CACHE_LINE_SIZE 128
|
||||
|
||||
/*
|
||||
*------------------------------------------------------------------------
|
||||
* The following symbols are for enabling debugging code, not for
|
||||
|
Reference in New Issue
Block a user