pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Introduce GUC shared_memory_size_in_huge_pages
Date: Tue, 21 Sep 2021 01:35:00 +0000
Message-ID: <E1mSUgW-0008Uq-FC@gemulon.postgresql.org> (raw)

Introduce GUC shared_memory_size_in_huge_pages

This runtime-computed GUC shows the number of huge pages required
for the server's main shared memory area, taking advantage of the
work done in 0c39c29 and 0bd305e.  This is useful for users to estimate
the amount of huge pages required for a server as it becomes possible to
do an estimation without having to start the server and potentially
allocate a large chunk of shared memory.

The number of huge pages is calculated based on the existing GUC
huge_page_size if set, or by using the system's default by looking at
/proc/meminfo on Linux.  There is nothing new here as this commit reuses
the existing calculation methods, and just exposes this information
directly to the user.  The routine calculating the huge page size is
refactored to limit the number of files with platform-specific flags.

This new GUC's name was the most popular choice based on the discussion
done.  This is only supported on Linux.

I have taken the time to test the change on Linux, Windows and MacOS,
though for the last two ones large pages are not supported.  The first
one calculates correctly the number of pages depending on the existing
GUC huge_page_size or the system's default.

Thanks to Andres Freund, Robert Haas, Kyotaro Horiguchi, Tom Lane,
Justin Pryzby (and anybody forgotten here) for the discussion.

Author: Nathan Bossart
Discussion: https://postgr.es/m/F2772387-CE0F-46BF-B5F1-CC55516EB885@amazon.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/43c1c4f65eab77bcfc4f535a7e9ac0421e0cf2a5

Modified Files
--------------
doc/src/sgml/config.sgml           | 21 +++++++++++++++++++
doc/src/sgml/ref/postgres-ref.sgml |  3 ++-
doc/src/sgml/runtime.sgml          | 27 +++++++++++-------------
src/backend/port/sysv_shmem.c      | 43 ++++++++++++++++++++++++++------------
src/backend/port/win32_shmem.c     | 14 +++++++++++++
src/backend/storage/ipc/ipci.c     | 14 +++++++++++++
src/backend/utils/misc/guc.c       | 12 +++++++++++
src/include/storage/pg_shmem.h     |  1 +
8 files changed, 106 insertions(+), 29 deletions(-)



Message-ID: <E1mSUgW-0008Uq-FC@gemulon.postgresql.org>
Permalink:  ../E1mSUgW-0008Uq-FC@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mSUgW-0008Uq-FC@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Introduce GUC shared_memory_size_in_huge_pages
  In-Reply-To: <E1mSUgW-0008Uq-FC@gemulon.postgresql.org>
  References: <E1mSUgW-0008Uq-FC@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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