Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u7ecO-003J4A-Fd for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Apr 2025 18:14:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u7ecK-008hEK-JU for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Apr 2025 18:14:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u7ecK-008hEC-9H for pgsql-hackers@lists.postgresql.org; Wed, 23 Apr 2025 18:14:41 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u7ecI-001Znp-0o; Wed, 23 Apr 2025 18:14:39 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 53NIEYQS1428550; Wed, 23 Apr 2025 14:14:34 -0400 From: Tom Lane To: Robert Haas cc: Daniel Gustafsson , Andres Freund , PostgreSQL Hackers , Rahila Syed Subject: Re: pgsql: Add function to get memory context stats for processes In-reply-to: References: <8EBFBFBC-DAC2-4521-AE16-069F7FD8EFBC@postgresql.org> Comments: In-reply-to Robert Haas message dated "Wed, 23 Apr 2025 12:12:11 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1428548.1745432074.1@sss.pgh.pa.us> Date: Wed, 23 Apr 2025 14:14:34 -0400 Message-ID: <1428549.1745432074@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas writes: > My primary concern about the patch is that > ProcessGetMemoryContextInterrupt() can be called from any > CHECK_FOR_INTERRUPTS() and calls lots of DSA functions, including > dsa_create() and, via PublishMemoryContext(), dsa_allocate0(). I'm > shocked to hear that you and Andres think that's safe to do at any > current or future CHECK_FOR_INTERRUPTS() anywhere in the code; but > Andres seems very confident that it's fine, so perhaps I should just > stop worrying and be happy that we have the feature. Just for the record, it sounds quite unsafe to me too. I could credit it being all right to examine the process' MemoryContext data structures, but calling dsa_create() from CFI seems really insane. Way too many moving parts there. regards, tom lane