Re: To Andres Freund
> Ok, so we leave the touching in, but still defend against negative
> status values?

v2 attached.

Christoph
>From f05e0f4503b920cd9f136f57dc9707a47786a69c Mon Sep 17 00:00:00 2001
From: Christoph Berg <m...@debian.org>
Date: Mon, 23 Jun 2025 17:50:41 +0200
Subject: [PATCH v2] Accept unmapped NUMA pages

We are touching all shared memory pages so move_pages can report their
status from our address space, but this might still leave some status
numbers to be negative error codes; -14 (EFAULT) was seen on 32-bit
Linux. Instead of erroring out, skip over these entries.
---
 src/backend/storage/ipc/shmem.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c
index c9ae3b45b76..21c1e5b2d62 100644
--- a/src/backend/storage/ipc/shmem.c
+++ b/src/backend/storage/ipc/shmem.c
@@ -700,13 +700,8 @@ pg_get_shmem_allocations_numa(PG_FUNCTION_ARGS)
 			int			s = pages_status[i];
 
 			/* Ensure we are adding only valid index to the array */
-			if (s < 0 || s > max_nodes)
-			{
-				elog(ERROR, "invalid NUMA node id outside of allowed range "
-					 "[0, " UINT64_FORMAT "]: %d", max_nodes, s);
-			}
-
-			nodes[s]++;
+			if (s >= 0 && s <= max_nodes)
+				nodes[s]++;
 		}
 
 		/*
-- 
2.47.2

Reply via email to