summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Munro2021-10-25 23:54:55 +0000
committerThomas Munro2021-10-25 23:54:55 +0000
commit8781b0ce25e702ba4a4f032d00da7acdef8dbfe1 (patch)
tree3c67d575dfe80a909194cc3a57f04be3c2c2adf2
parenta030a0c5ccb113ccd09d0f0b82f1edb5e49ed607 (diff)
Reject huge_pages=on if shared_memory_type=sysv.
It doesn't work (it could, but hasn't been implemented). Back-patch to 12, where shared_memory_type arrived. Reported-by: Alexander Lakhin <[email protected]> Reviewed-by: Alexander Lakhin <[email protected]> Discussion: https://postgr.es/m/[email protected]
-rw-r--r--doc/src/sgml/config.sgml4
-rw-r--r--src/backend/port/sysv_shmem.c6
2 files changed, 9 insertions, 1 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 4c73fe6ce8e..de77f145736 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -1664,7 +1664,9 @@ include_dir 'conf.d'
<para>
At present, this setting is supported only on Linux and Windows. The
setting is ignored on other systems when set to
- <literal>try</literal>.
+ <literal>try</literal>. On Linux, it is only supported when
+ <varname>shared_memory_type</varname> is set to <literal>mmap</literal>
+ (the default).
</para>
<para>
diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c
index cd385c4df65..e7474cee596 100644
--- a/src/backend/port/sysv_shmem.c
+++ b/src/backend/port/sysv_shmem.c
@@ -703,6 +703,12 @@ PGSharedMemoryCreate(Size size,
errmsg("huge pages not supported on this platform")));
#endif
+ /* For now, we don't support huge pages in SysV memory */
+ if (huge_pages == HUGE_PAGES_ON && shared_memory_type != SHMEM_TYPE_MMAP)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("huge pages not supported with the current shared_memory_type setting")));
+
/* Room for a header? */
Assert(size > MAXALIGN(sizeof(PGShmemHeader)));