Re: Draft for basic NUMA observability - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: Draft for basic NUMA observability
Date
Msg-id 21a5c622-6151-4339-8c72-f21c8cdc43b4@vondra.me
Whole thread Raw
In response to Re: Draft for basic NUMA observability  (Jakub Wartak <jakub.wartak@enterprisedb.com>)
List pgsql-hackers
Hi,

Here's a v26 of this patch series, merging the various fixup patches.
I've also reordered the patches so that the pg_buffercache part is last.
The two other patches are ready to go, and it seems better to push the
built-in catalog before the pg_buffercache contrib module.

For 0001 and 0002, I only have some minor tweaks - comment rewordings
etc. I kept them in separate patches to make it obvious, but I think
it's fine. The one specific tweak is to account for the +1 page, which
might happen if the buffers/pages are shifted in some way.

For 0003, I made some more serious changes - I reworked how buffers and
pages are mapped. I concluded that relying on pages_per_buffer and
buffer_per_pages is way too fiddly, if we can't guarantee the buffers
are not "shifted" in some way. Which I think we can't.

So I reworked that so that os_page_ptrs always points to actual pages
without duplicate pointers. And then for each buffer we calculate the
first page / last page, and iterate over those. A comment suggested the
old code made the retrieval simpler, but I find the new approach much
easier. And it doesn't have to worry how are the pages/buffers shifted
and so on.

The one caveat is that we can't know how many entries the function will
produce until after going through the buffers. We can say only calculate
the maximum number of entries. I think that's fine - we may allocate a
bit more space than needed, but we also save space in os_page_status.

I intend to push 0001 and 0002 shortly, and 0003 after a bit more review
and testing, unless I hear objections.


regards

-- 
Tomas Vondra

Attachment

pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: Commit fest 2025-03
Next
From: Andrew Dunstan
Date:
Subject: Re: [PATCH] Fix build on MINGW on ARM64