Skip to content

Commit 8781b0c

Browse files
committed
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 <exclusion@gmail.com> Reviewed-by: Alexander Lakhin <exclusion@gmail.com> Discussion: https://postgr.es/m/163271880203.22789.1125998876173795966@wrigleys.postgresql.org
1 parent a030a0c commit 8781b0c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

doc/src/sgml/config.sgml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,9 @@ include_dir 'conf.d'
16641664
<para>
16651665
At present, this setting is supported only on Linux and Windows. The
16661666
setting is ignored on other systems when set to
1667-
<literal>try</literal>.
1667+
<literal>try</literal>. On Linux, it is only supported when
1668+
<varname>shared_memory_type</varname> is set to <literal>mmap</literal>
1669+
(the default).
16681670
</para>
16691671

16701672
<para>

src/backend/port/sysv_shmem.c

+6
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,12 @@ PGSharedMemoryCreate(Size size,
703703
errmsg("huge pages not supported on this platform")));
704704
#endif
705705

706+
/* For now, we don't support huge pages in SysV memory */
707+
if (huge_pages == HUGE_PAGES_ON && shared_memory_type != SHMEM_TYPE_MMAP)
708+
ereport(ERROR,
709+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
710+
errmsg("huge pages not supported with the current shared_memory_type setting")));
711+
706712
/* Room for a header? */
707713
Assert(size > MAXALIGN(sizeof(PGShmemHeader)));
708714

0 commit comments

Comments
 (0)