Re: pgsql: Introduce pg_shmem_allocations_numa view - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: pgsql: Introduce pg_shmem_allocations_numa view
Date
Msg-id b54df21b-6595-4031-baf8-7c87851794c8@vondra.me
Whole thread Raw
In response to Re: pgsql: Introduce pg_shmem_allocations_numa view  (Christoph Berg <myon@debian.org>)
Responses Re: pgsql: Introduce pg_shmem_allocations_numa view
Re: pgsql: Introduce pg_shmem_allocations_numa view
List pgsql-hackers
On 6/24/25 17:30, Christoph Berg wrote:
> Re: Tomas Vondra
>> If it's a reliable fix, then I guess we can do it like this. But won't
>> that be a performance penalty on everyone? Or does the system split the
>> array into 16-element chunks anyway, so this makes no difference?
> 
> There's still the overhead of the syscall itself. But no idea how
> costly it is to have this 16-step loop in user or kernel space.
> 
> We could claim that on 32-bit systems, shared_buffers would be smaller
> anyway, so there the overhead isn't that big. And the step size should
> be larger (if at all) on 64-bit.
> 
>> Anyway, maybe we should start by reporting this to the kernel people. Do
>> you want me to do that, or shall one of you take care of that? I suppose
>> that'd be better, as you already wrote a fix / know the code better.
> 
> Submitted: https://marc.info/?l=linux-mm&m=175077821909222&w=2
> 

Thanks! Now we wait ...

Attached is a minor tweak of the valgrind suppresion rules, to add the
two places touching the memory. I was hoping I could add a single rule
for pg_numa_touch_mem_if_required, but that does not work - it's a
macro, not a function. So I had to add one rule for both functions,
querying the NUMA. That's a bit disappointing, because it means it'll
hide all other failues (of Memcheck:Addr8 type) in those functions.

Perhaps it'd be be better to turn pg_numa_touch_mem_if_required into a
proper (inlined) function, at least with USE_VALGRIND defined. Something
like the v2 patch - needs more testing to ensure the inlined function
doesn't break the touching or something silly like that.

regards

-- 
Tomas Vondra

Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [PATCH] Fix OAuth feature detection on OpenBSD+Meson
Next
From: Nathan Bossart
Date:
Subject: Re: like pg_shmem_allocations, but fine-grained for DSM registry ?