Re: Draft for basic NUMA observability

Patrick Stählin <me@packi.ch>

From: Patrick Stählin <me@packi.ch>
To: Tomas Vondra <tomas@vondra.me>, Jakub Wartak <jakub.wartak@enterprisedb.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Cc: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, Andres Freund <andres@anarazel.de>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: 2025-07-22T09:30:21Z
Lists: pgsql-hackers

Attachments

Hi!

On 4/7/25 11:27 PM, Tomas Vondra wrote:
> 
> I've pushed all three parts of v29, with some additional corrections
> (picked lower OIDs, bumped catversion, fixed commit messages).

While building the PG18 beta1/2 packages I noticed that in our build 
containers the selftest for pg_buffercache_numa and numa failed. It 
seems that libnuma was available and pg_numa_init/numa_available returns 
no errors, we still fail in pg_numa_query_pages/move_pages with EPERM 
yielding the following error when accessing 
pg_buffercache_numa/pg_shmem_allocations_numa:

   ERROR: failed NUMA pages inquiry: Operation not permitted

The man-page of move_pages lead me to believe that this is because of 
the missing capability CAP_SYS_NICE on the process but I couldn't prove 
that theory with the attached patch.
The patch did make the tests pass but also disabled NUMA permanently on 
a vanilla Debian VM and that is certainly not wanted. It may well be 
that my understanding of checking capabilities and how they work is 
incomplete. I also think that adding a new dependency for the reason of 
just checking the capability is probably a bit of an overkill, maybe we 
can check if we can access move_pages once without an error before 
treating it as one?

I'd be happy to debug this further but I have limited access to our 
build-infra, I should be able to sneak in commands during the build though.

Thanks,
Patrick

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