pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
The huge_pages parameter doesn't work when shared_memory_type is sysv
4+ messages / 3 participants
[nested] [flat]

* The huge_pages parameter doesn't work when shared_memory_type is sysv
@ 2021-09-27 05:00  PG Doc comments form <noreply@postgresql.org>
  0 siblings, 1 reply; 4+ messages in thread

From: PG Doc comments form @ 2021-09-27 05:00 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: exclusion@gmail.com

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/13/kernel-resources.html
Description:

It seems that the huge_pages parameter is ignored when shared_memory_type is
sysv. The server successfully starts with huge_pages=on, but actually
doesn't use huge pages (relying on /proc/meminfo).  I think that this is
worth mentioning in the "Linux Huge Pages" section.


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: The huge_pages parameter doesn't work when shared_memory_type is sysv
@ 2021-10-22 03:59  Thomas Munro <thomas.munro@gmail.com>
  parent: PG Doc comments form <noreply@postgresql.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Thomas Munro @ 2021-10-22 03:59 UTC (permalink / raw)
  To: Alexander Lakhin <exclusion@gmail.com>; Pg Docs <pgsql-docs@lists.postgresql.org>

On Mon, Sep 27, 2021 at 9:04 PM PG Doc comments form
<noreply@postgresql.org> wrote:
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/13/kernel-resources.html
> Description:
>
> It seems that the huge_pages parameter is ignored when shared_memory_type is
> sysv. The server successfully starts with huge_pages=on, but actually
> doesn't use huge pages (relying on /proc/meminfo).  I think that this is
> worth mentioning in the "Linux Huge Pages" section.

Yeah.  The thread that added shared_memory_type=sysv had an unfinished
follow-up patch that stalled[1].  The goal of that patch was to add
huge page support for shared_memory_type=sysv on AIX, and it is still
waiting for testing and polishing by an AIX-enabled hacker.  That
second patch included exactly such a documentation adjustment, and an
error message too (the idea was to reject that combination on Linux
but allow it on AIX).  Here are those bits, extracted.

https://www.postgresql.org/message-id/flat/HE1PR0202MB28126DB4E0B6621CC6A1A91286D90%40HE1PR0202MB281...

Attachments:

  [text/x-patch] 0001-Reject-huge_pages-on-if-shared_memory_type-sysv.patch (1.9K, ../../CA+hUKG+JJEk=Tg0r+-gHSX=9CPJe2UyFXgvh7c4Sd+0k_PO+eg@mail.gmail.com/2-0001-Reject-huge_pages-on-if-shared_memory_type-sysv.patch)
  download | inline diff:
From c27b1eae1a528f04ab09f60de80ccfa8fbaa7534 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Fri, 22 Oct 2021 16:49:22 +1300
Subject: [PATCH] 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>
Discussion: https://postgr.es/m/163271880203.22789.1125998876173795966@wrigleys.postgresql.org
---
 doc/src/sgml/config.sgml      | 4 +++-
 src/backend/port/sysv_shmem.c | 6 ++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 0bcc6fd322..1c13f995a5 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 cd385c4df6..e7474cee59 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)));
 
-- 
2.30.2



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: The huge_pages parameter doesn't work when shared_memory_type is sysv
@ 2021-10-22 20:20  Alexander Lakhin <exclusion@gmail.com>
  parent: Thomas Munro <thomas.munro@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Alexander Lakhin @ 2021-10-22 20:20 UTC (permalink / raw)
  To: Thomas Munro <thomas.munro@gmail.com>; Pg Docs <pgsql-docs@lists.postgresql.org>

Hello Thomas,

22.10.2021 06:59, Thomas Munro wrote:
> That
> second patch included exactly such a documentation adjustment, and an
> error message too (the idea was to reject that combination on Linux
> but allow it on AIX).  Here are those bits, extracted.
>
> https://www.postgresql.org/message-id/flat/HE1PR0202MB28126DB4E0B6621CC6A1A91286D90%40HE1PR0202MB281...
Thanks for the fix! It works and looks correct to me.

Best regards,
Alexander





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: The huge_pages parameter doesn't work when shared_memory_type is sysv
@ 2021-10-26 00:19  Thomas Munro <thomas.munro@gmail.com>
  parent: Alexander Lakhin <exclusion@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Thomas Munro @ 2021-10-26 00:19 UTC (permalink / raw)
  To: Alexander Lakhin <exclusion@gmail.com>; +Cc: Pg Docs <pgsql-docs@lists.postgresql.org>

On Sat, Oct 23, 2021 at 9:20 AM Alexander Lakhin <exclusion@gmail.com> wrote:
> Thanks for the fix! It works and looks correct to me.

Pushed.  Thanks.





^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2021-10-26 00:19 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27 05:00 The huge_pages parameter doesn't work when shared_memory_type is sysv PG Doc comments form <noreply@postgresql.org>
2021-10-22 03:59 ` Thomas Munro <thomas.munro@gmail.com>
2021-10-22 20:20   ` Alexander Lakhin <exclusion@gmail.com>
2021-10-26 00:19     ` Thomas Munro <thomas.munro@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox