Re: Add bump memory context type and use it for tuplesorts
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: David Rowley <dgrowleyml@gmail.com>,
Tomas Vondra <tomas.vondra@enterprisedb.com>,
Andres Freund <andres@anarazel.de>,
PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2024-04-04T20:43:36Z
Lists: pgsql-hackers
Matthias van de Meent <boekewurm+postgres@gmail.com> writes: > On Mon, 25 Mar 2024 at 22:44, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> Basically, I'm not happy with consuming the last reasonably-available >> pattern for a memory context type that has little claim to being the >> Last Context Type We Will Ever Want. Rather than making a further >> dent in our ability to detect corrupted chunks, we should do something >> towards restoring the expansibility that existed in the original >> design. Then we can add bump contexts and whatever else we want. > So, would something like the attached make enough IDs available so > that we can add the bump context anyway? > It extends memory context IDs to 5 bits (32 values), of which > - 8 have glibc's malloc pattern of 001/010; > - 1 is unused memory's 00000 > - 1 is wipe_mem's 11111 > - 4 are used by existing contexts (Aset/Generation/Slab/AlignedRedirect) > - 18 are newly available. This seems like it would solve the problem for a good long time to come; and if we ever need more IDs, we could steal one more bit by requiring the offset to the block header to be a multiple of 8. (Really, we could just about do that today at little or no cost ... machines with MAXALIGN less than 8 are very thin on the ground.) The only objection I can think of is that perhaps this would slow things down a tad by requiring more complicated shifting/masking. I wonder if we could redo the performance checks that were done on the way to accepting the current design. regards, tom lane
Commits
-
Update mmgr's README to mention BumpContext
- 58cf2e120e8a 17.0 landed
-
Push dedicated BumpBlocks to the tail of the blocks list
- 6d2fd66b9908 17.0 landed
-
Improve test coverage in bump.c
- bea97cd02ebb 17.0 cited
-
Fix incorrect KeeperBlock macro in bump.c
- 705ec0565371 17.0 landed
-
Use bump memory context for tuplesorts
- 6ed83d5fa55c 17.0 landed
-
Introduce a bump memory allocator
- 29f6a959cfd8 17.0 landed
-
Enlarge bit-space for MemoryContextMethodID
- 0ba8b75e7ea6 17.0 landed