pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add support for basic NUMA awareness
Date: Mon, 07 Apr 2025 21:18:10 +0000
Message-ID: <E1u1tr8-003BbL-20@gemulon.postgresql.org> (raw)

Add support for basic NUMA awareness

Add basic NUMA awareness routines, using a minimal src/port/pg_numa.c
portability wrapper and an optional build dependency, enabled by
--with-libnuma configure option. For now this is Linux-only, other
platforms may be supported later.

A built-in SQL function pg_numa_available() allows checking NUMA
support, i.e. that the server was built/linked with the NUMA library.

The main function introduced is pg_numa_query_pages(), which allows
determining the NUMA node for individual memory pages. Internally the
function uses move_pages(2) syscall, as it allows batching, and is more
efficient than get_mempolicy(2).

Author: Jakub Wartak <jakub.wartak@enterprisedb.com>
Co-authored-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reviewed-by: Tomas Vondra <tomas@vondra.me>
Discussion: https://postgr.es/m/CAKZiRmxh6KWo0aqRqvmcoaX2jUxZYb4kGp3N%3Dq1w%2BDiH-696Xw%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/65c298f61fc70f2f960437c05649f71b862e2c48

Modified Files
--------------
.cirrus.tasks.yml                   |   2 +
configure                           | 187 ++++++++++++++++++++++++++++++++++++
configure.ac                        |  14 +++
doc/src/sgml/func.sgml              |  13 +++
doc/src/sgml/installation.sgml      |  22 +++++
meson.build                         |  23 +++++
meson_options.txt                   |   3 +
src/Makefile.global.in              |   6 +-
src/backend/utils/misc/guc_tables.c |   2 +-
src/include/catalog/catversion.h    |   2 +-
src/include/catalog/pg_proc.dat     |   4 +
src/include/pg_config.h.in          |   3 +
src/include/port/pg_numa.h          |  40 ++++++++
src/include/storage/pg_shmem.h      |   1 +
src/makefiles/meson.build           |   3 +
src/port/Makefile                   |   1 +
src/port/meson.build                |   1 +
src/port/pg_numa.c                  | 120 +++++++++++++++++++++++
18 files changed, 444 insertions(+), 3 deletions(-)



view thread (13+ messages)  latest in thread

Message-ID: <E1u1tr8-003BbL-20@gemulon.postgresql.org>
Permalink:  ../E1u1tr8-003BbL-20@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1u1tr8-003BbL-20@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tomas.vondra@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Add support for basic NUMA awareness
  In-Reply-To: <E1u1tr8-003BbL-20@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