Skip to content

Commit 24b7cf8

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 a9d0a54 commit 24b7cf8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

doc/src/sgml/config.sgml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1568,7 +1568,9 @@ include_dir 'conf.d'
15681568
<para>
15691569
At present, this setting is supported only on Linux and Windows. The
15701570
setting is ignored on other systems when set to
1571-
<literal>try</literal>.
1571+
<literal>try</literal>. On Linux, it is only supported when
1572+
<varname>shared_memory_type</varname> is set to <literal>mmap</literal>
1573+
(the default).
15721574
</para>
15731575

15741576
<para>

src/backend/port/sysv_shmem.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,12 @@ PGSharedMemoryCreate(Size size,
658658
errmsg("huge pages not supported on this platform")));
659659
#endif
660660

661+
/* For now, we don't support huge pages in SysV memory */
662+
if (huge_pages == HUGE_PAGES_ON && shared_memory_type != SHMEM_TYPE_MMAP)
663+
ereport(ERROR,
664+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
665+
errmsg("huge pages not supported with the current shared_memory_type setting")));
666+
661667
/* Room for a header? */
662668
Assert(size > MAXALIGN(sizeof(PGShmemHeader)));
663669

0 commit comments

Comments
 (0)