]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Adjust DSM and DSA slot usage constants (back-patch).
authorThomas Munro <tmunro@postgresql.org>
Thu, 19 Nov 2020 21:44:09 +0000 (10:44 +1300)
committerThomas Munro <tmunro@postgresql.org>
Thu, 19 Nov 2020 21:52:38 +0000 (10:52 +1300)
1.  Previously, a DSA area would create up to four segments at each size
before doubling the size.  After this commit, it will create only two at
each size, so it ramps up faster and therefore needs fewer slots.

2.  Previously, the total limit on DSM slots allowed for 2 per connection.
Switch to 5 per connection.

This back-patches commit d061ea21 from release 13 into 10-12 based on a
field complaint.

Discussion: https://postgr.es/m/CAO03teA%2BjE1qt5iWDWzHqaufqBsF6EoOgZphnazps_tr_jDPZA%40mail.gmail.com
Discussion: https://postgr.es/m/CA%2BhUKGL6H2BpGbiF7Lj6QiTjTGyTLW_vLR%3DSn2tEBeTcYXiMKw%40mail.gmail.com

src/backend/storage/ipc/dsm.c
src/backend/utils/mmgr/dsa.c

index df2e31486fa9f1d3b431fe910f7cfc296eb876ff..3ecc62c99eb6b5857885e29b59c1ca541c954fe3 100644 (file)
 
 #define PG_DYNSHMEM_CONTROL_MAGIC              0x9a503d32
 
-/*
- * There's no point in getting too cheap here, because the minimum allocation
- * is one OS page, which is probably at least 4KB and could easily be as high
- * as 64KB.  Each currently sizeof(dsm_control_item), currently 8 bytes.
- */
 #define PG_DYNSHMEM_FIXED_SLOTS                        64
-#define PG_DYNSHMEM_SLOTS_PER_BACKEND  2
+#define PG_DYNSHMEM_SLOTS_PER_BACKEND  5
 
 #define INVALID_CONTROL_SLOT           ((uint32) -1)
 
index dc7619c9059f40756e97432a31fa1a7ef86f1436..46a341ef31c1bc25defda0ee884fef38395ff1f5 100644 (file)
@@ -74,7 +74,7 @@
  * dsm.c's limits on total number of segments), or limiting the total size
  * an area can manage when using small pointers.
  */
-#define DSA_NUM_SEGMENTS_AT_EACH_SIZE 4
+#define DSA_NUM_SEGMENTS_AT_EACH_SIZE 2
 
 /*
  * The number of bits used to represent the offset part of a dsa_pointer.