Re: Draft for basic NUMA observability

From: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Tomas Vondra <tomas(at)vondra(dot)me>, Andres Freund <andres(at)anarazel(dot)de>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Draft for basic NUMA observability
Date: 2025-04-07 10:32:52
Message-ID: CAKZiRmyxtDxoDHZVC2MBsf3fC__sG9k_idNwKCrC6LFm_UWMEw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 7, 2025 at 11:53 AM Bertrand Drouvot
<bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
>
> Hi,
>
> On Mon, Apr 07, 2025 at 10:09:26AM +0200, Jakub Wartak wrote:
> > Bertrand noticed this first in
> > https://www.postgresql.org/message-id/Z/FhOOCmTxuB2h0b%40ip-10-97-1-34.eu-west-3.compute.internal
> > :
> >
> > - startptr = (char *) BufferGetBlock(1);
> > + startptr = (char *) TYPEALIGN_DOWN(os_page_size, (char
> > *) BufferGetBlock(1));
> >
> > With the above I'm also not getting wonky (-1) results anymore. The
> > rest of reply assumes we are using this.
>
> yeah, I can see that you added it in v25-0007. In the same message I mentioned
> to "use the actual buffer address when pg_numa_touch_mem_if_required()
> is called?"
>
> So, to be extra cautious we could do something like:
>
> @@ -474,7 +474,7 @@ pg_buffercache_numa_pages(PG_FUNCTION_ARGS)
>
> /* Only need to touch memory once per backend process lifetime */
> if (firstNumaTouch)
> - pg_numa_touch_mem_if_required(touch, os_page_ptrs[idx]);
> + pg_numa_touch_mem_if_required(touch, buffptr + (j * os_page_size));
>
>
> what do you think?

Yeah, I think we could include this too as it looks safer (sry I've
missed that one). Attached v25 as it was , with this little tweak.

-J.

Attachment Content-Type Size
v25-0003-Introduce-pg_shmem_allocations_numa-view.patch application/octet-stream 17.0 KB
v25-0004-adjust-page-alignment.patch application/octet-stream 1.9 KB
v25-0001-Add-pg_buffercache_numa-view-with-NUMA-node-info.patch application/octet-stream 21.0 KB
v25-0005-fixes-for-review-by-Andres.patch application/octet-stream 5.3 KB
v25-0006-fix-remaining-outstanding-issues-from-Sunday.patch application/octet-stream 4.4 KB
v25-0002-adjust-page_num.patch application/octet-stream 1.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2025-04-07 11:33:30 Re: [PATCH] clarify palloc comment on quote_literal_cstr
Previous Message Álvaro Herrera 2025-04-07 10:13:03 Re: Unquoted file name in an error message