summaryrefslogtreecommitdiff
path: root/src/backend/utils/misc/guc.c
diff options
context:
space:
mode:
authorThomas Munro2020-07-31 05:27:09 +0000
committerThomas Munro2020-07-31 05:49:58 +0000
commit84b1c63ad41872792d47e523363fce1f0e230022 (patch)
treecc9ecdfd4f66edbcc5a1382598de5ba502023be9 /src/backend/utils/misc/guc.c
parent7b1110d2fd3da3d7536530d14952d4f4d9c25438 (diff)
Preallocate some DSM space at startup.
Create an optional region in the main shared memory segment that can be used to acquire and release "fast" DSM segments, and can benefit from huge pages allocated at cluster startup time, if configured. Fall back to the existing mechanisms when that space is full. The size is controlled by a new GUC min_dynamic_shared_memory, defaulting to 0. Main region DSM segments initially contain whatever garbage the memory held last time they were used, rather than zeroes. That change revealed that DSA areas failed to initialize themselves correctly in memory that wasn't zeroed first, so fix that problem. Discussion: https://postgr.es/m/CA%2BhUKGLAE2QBv-WgGp%2BD9P_J-%3Dyne3zof9nfMaqq1h3EGHFXYQ%40mail.gmail.com
Diffstat (limited to 'src/backend/utils/misc/guc.c')
-rw-r--r--src/backend/utils/misc/guc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index c20885e97b2..6c6bb220149 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -2231,6 +2231,17 @@ static struct config_int ConfigureNamesInt[] =
NULL, NULL, NULL
},
+ {
+ {"min_dynamic_shared_memory", PGC_POSTMASTER, RESOURCES_MEM,
+ gettext_noop("Amount of dynamic shared memory reserved at startup."),
+ NULL,
+ GUC_UNIT_MB
+ },
+ &min_dynamic_shared_memory,
+ 0, 0, Min(INT_MAX, SIZE_MAX / 1024 / 1024),
+ NULL, NULL, NULL
+ },
+
/*
* We sometimes multiply the number of shared buffers by two without
* checking for overflow, so we mustn't allow more than INT_MAX / 2.