Re: pgsql: Introduce pg_shmem_allocations_numa view

From: Tomas Vondra <tomas(at)vondra(dot)me>
To: Christoph Berg <myon(at)debian(dot)org>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Introduce pg_shmem_allocations_numa view
Date: 2025-06-23 20:37:12
Message-ID: ce305c79-0a68-46ce-b563-ab9f87bb5f20@vondra.me
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Christoph Berg 2025-06-23 20:51:49 Re: pgsql: Introduce pg_shmem_allocations_numa view
Previous Message Christoph Berg 2025-06-23 20:31:50 Re: pgsql: Introduce pg_shmem_allocations_numa view

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2025-06-23 20:51:49 Re: pgsql: Introduce pg_shmem_allocations_numa view
Previous Message Christoph Berg 2025-06-23 20:31:50 Re: pgsql: Introduce pg_shmem_allocations_numa view