Add support for basic NUMA awareness
Tomas Vondra <tomas.vondra@postgresql.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| .cirrus.tasks.yml | modified | +2 −0 |
| configure | modified | +187 −0 |
| configure.ac | modified | +14 −0 |
| doc/src/sgml/func.sgml | modified | +13 −0 |
| doc/src/sgml/installation.sgml | modified | +22 −0 |
| meson.build | modified | +23 −0 |
| meson_options.txt | modified | +3 −0 |
| src/backend/utils/misc/guc_tables.c | modified | +1 −1 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/catalog/pg_proc.dat | modified | +4 −0 |
| src/include/pg_config.h.in | modified | +3 −0 |
| src/include/port/pg_numa.h | added | +40 −0 |
| src/include/storage/pg_shmem.h | modified | +1 −0 |
| src/Makefile.global.in | modified | +5 −1 |
| src/makefiles/meson.build | modified | +3 −0 |
| src/port/Makefile | modified | +1 −0 |
| src/port/meson.build | modified | +1 −0 |
| src/port/pg_numa.c | added | +120 −0 |
Documentation touched
Discussion
- Draft for basic NUMA observability 115 messages · 2025-02-07 → 2025-07-25