From: Thomas Munro Date: Mon, 25 Oct 2021 23:54:55 +0000 (+1300) Subject: Reject huge_pages=on if shared_memory_type=sysv. X-Git-Tag: REL_13_5~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=24b7cf8a5cff0b0e2dba12a3a1f5c7638ace9986;p=thirdparty%2Fpostgresql.git 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 Reviewed-by: Alexander Lakhin Discussion: https://postgr.es/m/163271880203.22789.1125998876173795966@wrigleys.postgresql.org --- diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 92ac53f9a5e..661bba99417 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1568,7 +1568,9 @@ include_dir 'conf.d' At present, this setting is supported only on Linux and Windows. The setting is ignored on other systems when set to - try. + try. On Linux, it is only supported when + shared_memory_type is set to mmap + (the default). diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c index 63a4de54b50..4b0b0b226c1 100644 --- a/src/backend/port/sysv_shmem.c +++ b/src/backend/port/sysv_shmem.c @@ -658,6 +658,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)));