Re: Draft for basic NUMA observability

Tomas Vondra <tomas@vondra.me>

From: Tomas Vondra <tomas@vondra.me>
To: Andres Freund <andres@anarazel.de>
Cc: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, Jakub Wartak <jakub.wartak@enterprisedb.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Nazir Bilal Yavuz <byavuz81@gmail.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-04-07T17:16:58Z
Lists: pgsql-hackers
On 4/7/25 18:42, Andres Freund wrote:
> ...
>>>
>>> Of course that would mean that we'd always need to
>>> pg_numa_touch_mem_if_required(), not just the first time round, because we
>>> previously might not have for a page that is now valid.  But compared to the
>>> cost of actually allocating pages, the cost for that seems small.
>>
>> I suppose by "range" you mean buffers on a given memory page
> 
> Correct.
> 
>> and  "valid" means BufferIsValid.
> 
> I was thinking of checking if the BufferDesc indicates BM_VALID or
> BM_TAG_VALID.
> 
> BufferIsValid() just does a range check :(.
> 

Well, I guess BufferIsValid() seems a tad confusing ...

> 
>> Yeah, that probably means the memory page is allocated. But if the buffer is
>> invalid, it does not mean the memory is not allocated, right? So does it
>> make the buffer not interesting?
> 
> Well, you don't have contents in it it can't really affect performance.  But
> yea, I agree, it's not perfect either.
> 
> 
>> I think we need to decide whether the current patches are good enough
>> for PG18, with the current behavior, and then maybe improve that in
>> PG19.
> 
> I think as long as the docs mention this with <note> or <warning> it's ok for
> now.
> 

OK, I'll add a warning explaining this.


regards

-- 
Tomas Vondra




Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. doc: Correct pg_shmem_allocations_numa.size data type

  2. Add pg_buffercache_numa view with NUMA node info

  3. Add support for basic NUMA awareness

  4. Introduce pg_shmem_allocations_numa view