From 30a104a5b3e9567f2410b75d5fefb57d2144e606 Mon Sep 17 00:00:00 2001 From: Tomas Vondra Date: Wed, 15 Oct 2025 16:33:55 +0200 Subject: [PATCH v20251015 09/12] fix: move memset after PGPROC partitioning The memset faults the pages into memory, which interferes with the NUMA (see e.g. the requirements for numa_interleave_memory). Reported by Alexey Makhmutov. Discussion: bf95094a-77c2-46cf-913a-443f7419bc79@postgrespro.ru --- src/backend/storage/lmgr/proc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index 70ccfebef55..56812a05860 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -368,8 +368,6 @@ InitProcGlobal(void) requestSize, &found); - MemSet(ptr, 0, requestSize); - /* allprocs (array of pointers to PGPROC entries) */ procs = (PGPROC **) ptr; ptr = (char *) ptr + CACHELINEALIGN(TotalProcs * sizeof(PGPROC *)); @@ -458,6 +456,12 @@ InitProcGlobal(void) Assert((ptr > (char *) procs) && (ptr <= (char *) procs + requestSize)); } + /* + * Don't memset the memory before locating it to NUMA nodes (which requires + * the pages to be allocated but not yet faulted in memory). + */ + MemSet(ptr, 0, requestSize); + /* * Allocate arrays mirroring PGPROC fields in a dense manner. See * PROC_HDR. -- 2.51.0