Fix comment in pg_get_shmem_allocations_numa()
authorMichael Paquier <[email protected]>
Tue, 21 Oct 2025 07:12:34 +0000 (16:12 +0900)
committerMichael Paquier <[email protected]>
Tue, 21 Oct 2025 07:12:34 +0000 (16:12 +0900)
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 <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 18

src/backend/storage/ipc/shmem.c

index ca3656fc76f4300ab23b8d664dcaea38a45ed804..ff3a738c19cb74954c7d70732e7e395c06250b5d 100644 (file)
@@ -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();