Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uTnut-00AARf-BZ for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Jun 2025 20:37:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uTnur-006Sjv-3t for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Jun 2025 20:37:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uTnuq-006Sjn-QY for pgsql-hackers@lists.postgresql.org; Mon, 23 Jun 2025 20:37:21 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1uTnuo-003blL-1L for pgsql-hackers@lists.postgresql.org; Mon, 23 Jun 2025 20:37:20 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id B5867443B3; Mon, 23 Jun 2025 20:37:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vondra.me; s=gm1; t=1750711034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tQUcVKQ+FyJqmampdwQLRsriA9ssDjVN9p3+lD+C7Ts=; b=SWwjvU8h9JK5BxGJsDthK6gEFOhVCwe3iTITA3x02vmtS19aiGRsfsRSIvDw/DRWOeTs3r xvKrUfetPmYE+crtDL+tw1ub1yCTLUFt272whNBay+UUVF1iAHl0ETPH2cI9rtLdANv0xv xTIGIlu8un6gII58RL7MAFF0uRrTxM1o7AKcQylGCxzGplQp5bb/QfI0Akh2kcGPjBgAB9 L8z0Cu2LtWb8AvCK0AiFBV+m6csegitJfhFpk7uQwsYumdkGPOAU9vAERJF0MtEWqeuFi4 jyeMClMm9smHa1EG0yKYkEVmVY0hHH0ZoqNPsYd6YbPjLog67qmCacF0YlxVaQ== Message-ID: Date: Mon, 23 Jun 2025 22:37:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pgsql: Introduce pg_shmem_allocations_numa view To: Christoph Berg Cc: Andres Freund , Tomas Vondra , pgsql-hackers@lists.postgresql.org References: <6c9f9f7e-947b-4fc3-bdb6-b0696d7492e5@vondra.me> Content-Language: en-US From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddvgddujeellecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpefvohhmrghsucggohhnughrrgcuoehtohhmrghssehvohhnughrrgdrmhgvqeenucggtffrrghtthgvrhhnpeeludegieekgfelhffgffeuvdelteetveeghfdvieekfeduudduvdfhvedufefhveenucfkphepkeeirdegledrvdeftddrvddtieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeekiedrgeelrddvfedtrddvtdeipdhhvghloheplgdutddrudefjedrtddrvdgnpdhmrghilhhfrhhomhepthhomhgrshesvhhonhgurhgrrdhmvgdpnhgspghrtghpthhtohepgedprhgtphhtthhopehmhihonhesuggvsghirghnrdhorhhgpdhrtghpthhtoheprghnughrvghssegrnhgrrhgriigvlhdruggvpdhrtghpthhtohepthhomhgrshdrvhhonhgurhgrsehpohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-GND-Sasl: tomas@vondra.me List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/23/25 22:31, Christoph Berg wrote: > Re: Tomas Vondra >> Huh. So it's only the first call that does this? > > The first call after a restart. Reconnecting is not enough. > >> Can you maybe print the addresses passed to pg_numa_query_pages? I > > The addresses look good: > > Breakpoint 1, pg_numa_query_pages (pid=0, count=32768, pages=0xeb44d02c, status=0xeb42c02c) at ../src/port/pg_numa.c:49 > 49 return numa_move_pages(pid, count, pages, NULL, status, 0); > (gdb) p *pages > $1 = (void *) 0xebc33000 > (gdb) p pages[1] > $2 = (void *) 0xebc34000 > (gdb) p pages[2] > $3 = (void *) 0xebc35000 > Didn't you say the first ~35 addresses succeed, right? What about the addresses after that? > >> wonder if there's some bug in how we fill that array. Not sure why would >> it happen only on 32-bit systems, though. > > I found something, but that should be harmless: > > --- a/contrib/pg_buffercache/pg_buffercache_pages.c > +++ b/contrib/pg_buffercache/pg_buffercache_pages.c > @@ -365,7 +365,7 @@ pg_buffercache_numa_pages(PG_FUNCTION_ARGS) > > /* Used to determine the NUMA node for all OS pages at once */ > os_page_ptrs = palloc0(sizeof(void *) * os_page_count); > - os_page_status = palloc(sizeof(uint64) * os_page_count); > + os_page_status = palloc(sizeof(int) * os_page_count); > Yes, good catch. But as you say, that should be benign - we allocate more memory than needed, I don't think it should break anything. -- Tomas Vondra