pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Silence valgrind about pg_numa_touch_mem_if_required
2+ messages / 1 participants
[nested] [flat]

* pgsql: Silence valgrind about pg_numa_touch_mem_if_required
@ 2025-07-01 10:34 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Tomas Vondra @ 2025-07-01 10:34 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Silence valgrind about pg_numa_touch_mem_if_required

When querying NUMA status of pages in shared memory, we need to touch
the memory first to get valid results. This may trigger valgrind
reports, because some of the memory (e.g. unpinned buffers) may be
marked as noaccess.

Solved by adding a valgrind suppresion. An alternative would be to
adjust the access/noaccess status before touching the memory, but that
seems far too invasive. It would require all those places to have
detailed knowledge of what the shared memory stores.

The pg_numa_touch_mem_if_required() macro is replaced with a function.
Macros are invisible to suppressions, so it'd have to suppress reports
for the caller - e.g. pg_get_shmem_allocations_numa(). So we'd suppress
reports for the whole function, and that seems to heavy-handed. It might
easily hide other valid issues.

Reviewed-by: Christoph Berg <myon@debian.org>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aEtDozLmtZddARdB@msg.df7cb.de
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/81f287dc923f565722f46b18d71969926bc3c64f

Modified Files
--------------
contrib/pg_buffercache/pg_buffercache_pages.c |  3 +--
src/backend/storage/ipc/shmem.c               |  4 +---
src/include/port/pg_numa.h                    | 10 +++++++---
src/tools/valgrind.supp                       | 14 ++++++++++++++
4 files changed, 23 insertions(+), 8 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Silence valgrind about pg_numa_touch_mem_if_required
@ 2025-07-01 10:34 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Tomas Vondra @ 2025-07-01 10:34 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Silence valgrind about pg_numa_touch_mem_if_required

When querying NUMA status of pages in shared memory, we need to touch
the memory first to get valid results. This may trigger valgrind
reports, because some of the memory (e.g. unpinned buffers) may be
marked as noaccess.

Solved by adding a valgrind suppresion. An alternative would be to
adjust the access/noaccess status before touching the memory, but that
seems far too invasive. It would require all those places to have
detailed knowledge of what the shared memory stores.

The pg_numa_touch_mem_if_required() macro is replaced with a function.
Macros are invisible to suppressions, so it'd have to suppress reports
for the caller - e.g. pg_get_shmem_allocations_numa(). So we'd suppress
reports for the whole function, and that seems to heavy-handed. It might
easily hide other valid issues.

Reviewed-by: Christoph Berg <myon@debian.org>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aEtDozLmtZddARdB@msg.df7cb.de
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/14e52227e57885d1a983d9f2515b569d3180c93d

Modified Files
--------------
contrib/pg_buffercache/pg_buffercache_pages.c |  3 +--
src/backend/storage/ipc/shmem.c               |  4 +---
src/include/port/pg_numa.h                    | 10 +++++++---
src/tools/valgrind.supp                       | 14 ++++++++++++++
4 files changed, 23 insertions(+), 8 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-07-01 10:34 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-07-01 10:34 pgsql: Silence valgrind about pg_numa_touch_mem_if_required Tomas Vondra <tomas.vondra@postgresql.org>
2025-07-01 10:34 pgsql: Silence valgrind about pg_numa_touch_mem_if_required Tomas Vondra <tomas.vondra@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox