Re: Improve monitoring of shared memory allocations
Rahila Syed <rahilasyed90@gmail.com>
From: Rahila Syed <rahilasyed90@gmail.com>
To: Tomas Vondra <tomas@vondra.me>
Cc: Nazir Bilal Yavuz <byavuz81@gmail.com>,
Andres Freund <andres@anarazel.de>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-03-30T23:01:33Z
Lists: pgsql-hackers
Attachments
- v7-0002-Replace-ShmemAlloc-calls-by-ShmemInitStruct.patch (application/octet-stream) patch v7-0002
- v7-0003-Add-cacheline-padding-between-heavily-accessed-array.patch (application/octet-stream) patch v7-0003
- v7-0001-Account-for-all-the-shared-memory-allocated-by-hash_.patch (application/octet-stream) patch v7-0001
Hi Tomas, > > Right. I'm still not convinced if this makes any difference, or whether > this alignment was merely a consequence of using ShmemAlloc(). I don't > want to make this harder to understand unnecessarily. > Yeah, it makes sense. > Let's keep this simple - without additional alignment. I'll think about > it a bit more, and maybe add it before commit. > OK. > > > > I will improve the comment in the next version. > > > > OK. Do we even need to pass nelem_alloc to hash_get_init_size? It's not > really used except for this bit: > > + if (init_size > nelem_alloc) > + element_alloc = false; > > Can't we determine before calling the function, to make it a bit less > confusing? > Yes, we could determine whether the pre-allocated elements are zero before calling the function, I have fixed it accordingly in the attached 0001 patch. Now, there's no need to pass `nelem_alloc` as a parameter. Instead, I've passed this information as a boolean variable-initial_elems. If it is false, no elements are pre-allocated. Please find attached the v7-series, which incorporates your review patches and addresses a few remaining comments. Thank you, Rahila Syed
Commits
-
Allocate all parts of shmem hash table from a single contiguous area
- 9fe9ecd516b0 19 (unreleased) cited
-
Improve accounting for PredXactList, RWConflictPool and PGPROC
- 46df9487d973 18.0 landed
-
Improve accounting for memory used by shared hash tables
- f5930f9a98ea 18.0 landed