1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-14 08:21:07 +03:00

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
This commit is contained in:
Thomas Munro
2020-07-31 17:27:09 +12:00
parent 7b1110d2fd
commit 84b1c63ad4
9 changed files with 216 additions and 26 deletions

View File

@ -113,6 +113,9 @@ const struct config_enum_entry dynamic_shared_memory_options[] = {
/* Implementation selector. */
int dynamic_shared_memory_type;
/* Amount of space reserved for DSM segments in the main area. */
int min_dynamic_shared_memory;
/* Size of buffer to be used for zero-filling. */
#define ZBUFFER_SIZE 8192