Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Reject huge_pages=on if shared_memory_type=sysv.
authorThomas Munro <tmunro@postgresql.org>
Mon, 25 Oct 2021 23:54:55 +0000 (12:54 +1300)
committerThomas Munro <tmunro@postgresql.org>
Tue, 26 Oct 2021 00:01:52 +0000 (13:01 +1300)
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

doc/src/sgml/config.sgml
src/backend/port/sysv_shmem.c

index 505a263301dc4d69773e8e75fdbd4899efb14034..fd015cf6baa423d2f62973040510bf28a2d5c7f1 100644 (file)
@@ -1573,7 +1573,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>
index 3267648c959ff11c3581af523fabed4fc99c38f8..bbe1a682acb7e3ef69f24b4b6075f988d67eeb17 100644 (file)
@@ -649,6 +649,12 @@ PGSharedMemoryCreate(Size size, int port,
                 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)));