Re: pgsql: Add function to get memory context stats for processes

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Daniel Gustafsson <dgustafsson(at)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Rahila Syed <rahilasyed90(at)gmail(dot)com>
Subject: Re: pgsql: Add function to get memory context stats for processes
Date: 2025-04-14 14:03:28
Message-ID: CA+Tgmob7yyONbdv-DRRrWxQPL9AsXFxzs3OH1F6vxSc14prLFA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Thu, Apr 10, 2025 at 4:05 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
> I don't know of existing discussion, but it seems rather fundamental to me -
> if either DSA or memory contexts could be inconsistent at a CFI(), how could
> it possibly be safe to interrupt at that point? After all, after an error you
> need to be able to reset the memory contexts / release memory in a
> dsa/dshash/whatnot? Memory context reset requires walking over the allocations
> made in the context, similar releasing a dsa?

I think it would be a bit surprising if somebody put a
CHECK_FOR_INTERRUPTS() inside aset.c or similar, but I don't see a
reason why we couldn't end up with one reachable via the DSA code. DSA
calls DSM which depending on dynamic_shared_memory_type might involve
filesystem operations. That's a fairly large amount of code. I admit I
have no particular theory about how CFI could be reachable from there
today, but even if it definitely isn't, I don't see why someone would
hesitate to add one in the future.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2025-04-14 14:13:27 Re: pgsql: Add function to get memory context stats for processes
Previous Message Álvaro Herrera 2025-04-14 12:20:10 Re: pgsql: Non text modes for pg_dumpall, correspondingly change pg_restore

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-04-14 14:13:27 Re: pgsql: Add function to get memory context stats for processes
Previous Message Christoph Moench-Tegeder 2025-04-14 13:47:13 Re: rounding_up