diff options
| author | Michael Paquier <michael@paquier.xyz> | 2025-10-21 16:12:30 +0900 |
|---|---|---|
| committer | Michael Paquier <michael@paquier.xyz> | 2025-10-21 16:12:30 +0900 |
| commit | e4e496e88c9a0940abe1ade44337577b26f032a0 (patch) | |
| tree | 85abe0af5956f02b2ff50ff828b93e513ef03df3 | |
| parent | 18d2614093481cb7ae89e1f5b72f3ddf5fb49b4c (diff) | |
Fix comment in pg_get_shmem_allocations_numa()
The comment fixed in this commit described the function as dealing with
database blocks, but in reality it processes shared memory allocations.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aH4DDhdiG9Gi0rG7@ip-10-97-1-34.eu-west-3.compute.internal
Backpatch-through: 18
| -rw-r--r-- | src/backend/storage/ipc/shmem.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c index a0770e86796..b3d0a10792d 100644 --- a/src/backend/storage/ipc/shmem.c +++ b/src/backend/storage/ipc/shmem.c @@ -606,16 +606,13 @@ pg_get_shmem_allocations_numa(PG_FUNCTION_ARGS) nodes = palloc(sizeof(Size) * (max_nodes + 1)); /* - * Different database block sizes (4kB, 8kB, ..., 32kB) can be used, while - * the OS may have different memory page sizes. + * Shared memory allocations can vary in size and may not align with OS + * memory page boundaries, while NUMA queries work on pages. * - * To correctly map between them, we need to: 1. Determine the OS memory - * page size 2. Calculate how many OS pages are used by all buffer blocks - * 3. Calculate how many OS pages are contained within each database - * block. - * - * This information is needed before calling move_pages() for NUMA memory - * node inquiry. + * To correctly map each allocation to NUMA nodes, we need to: 1. + * Determine the OS memory page size. 2. Align each allocation's start/end + * addresses to page boundaries. 3. Query NUMA node information for all + * pages spanning the allocation. */ os_page_size = pg_get_shmem_pagesize(); |
