Re: like pg_shmem_allocations, but fine-grained for DSM registry ?

From: Florents Tselai <florents(dot)tselai(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: like pg_shmem_allocations, but fine-grained for DSM registry ?
Date: 2025-03-14 21:44:54
Message-ID: CA+v5N436pDJT6jOds0UzgyPqck3CNThnMzqCPZ8sJG3xp+KJvA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 14, 2025 at 4:16 PM Nathan Bossart <nathandbossart(at)gmail(dot)com>
wrote:

> On Thu, Mar 13, 2025 at 06:54:09PM +0200, Florents Tselai wrote:
> > I扉e been working with the DSM registry API.
> > I was wondering if it is possible (it doesn愒 look like it) or if it has
> been discussed:
> > can we expose a view like pg_shmem_allocations, but fine-grained for
> every named segment (i.e. created by GetNamedDSMSegment )?
> >
> > Currently, there is a "DSM Registry Data" entry in that view,
> > but iiuc, it愀 only about the top-level hash table the registry uses.
>
> This seems like a generally reasonable idea to me. In theory, it should be
> easy enough to build something that walks through the DSM registry hash
> table.
>

Here's a first attempt towards a view pg_dsm_registry(name, size) that
does just that
So, using the test_dsm_registry module as a test bed,

it would look like this.

CREATE EXTENSION test_dsm_registry;
SELECT set_val_in_shmem(1236);
set_val_in_shmem
------------------

(1 row)

-- 20 bytes = int (4 bytes) + LWLock (16bytes)
SELECT * FROM pg_dsm_registry;
name | size
-------------------+------
test_dsm_registry | 20
(1 row)

I'll create a cf entry to keep track of this

Attachment Content-Type Size
v1-pg_dsm_registry-view.patch application/x-patch 6.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2025-03-14 21:46:54 Re: PG_CFLAGS rpath Passthrough Issue
Previous Message Laurenz Albe 2025-03-14 21:13:52 Re: PG_CFLAGS rpath Passthrough Issue