PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
pg_numa.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * pg_numa.h
4 * Basic NUMA portability routines
5 *
6 *
7 * Copyright (c) 2025, PostgreSQL Global Development Group
8 *
9 * IDENTIFICATION
10 * src/include/port/pg_numa.h
11 *
12 *-------------------------------------------------------------------------
13 */
14#ifndef PG_NUMA_H
15#define PG_NUMA_H
16
17extern PGDLLIMPORT int pg_numa_init(void);
18extern PGDLLIMPORT int pg_numa_query_pages(int pid, unsigned long count, void **pages, int *status);
19extern PGDLLIMPORT int pg_numa_get_max_node(void);
20
21#ifdef USE_LIBNUMA
22
23/*
24 * This is required on Linux, before pg_numa_query_pages() as we
25 * need to page-fault before move_pages(2) syscall returns valid results.
26 */
27static inline void
29{
30 volatile uint64 touch pg_attribute_unused();
31
32 touch = *(volatile uint64 *) ptr;
33}
34
35#else
36
37#define pg_numa_touch_mem_if_required(ptr) \
38 do {} while(0)
39
40#endif
41
42#endif /* PG_NUMA_H */
#define PGDLLIMPORT
Definition: c.h:1323
#define pg_attribute_unused()
Definition: c.h:136
uint64_t uint64
Definition: c.h:543
PGDLLIMPORT int pg_numa_get_max_node(void)
Definition: pg_numa.c:126
#define pg_numa_touch_mem_if_required(ptr)
Definition: pg_numa.h:37
PGDLLIMPORT int pg_numa_query_pages(int pid, unsigned long count, void **pages, int *status)
Definition: pg_numa.c:120
PGDLLIMPORT int pg_numa_init(void)
Definition: pg_numa.c:113