From: | David Rowley <drowley(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Optimize GenerationAlloc() and SlabAlloc() |
Date: | 2024-03-04 04:42:31 |
Message-ID: | E1rh09n-001yx2-3X@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Optimize GenerationAlloc() and SlabAlloc()
In a similar effort to 413c18401, separate out the hot and cold paths in
GenerationAlloc() and SlabAlloc() to avoid having to setup the stack frame
for the hot path.
This additionally adjusts how we use the GenerationContext's freeblock.
Freeblock, when set, is now always empty and we only switch to using it
when the current allocation request finds the current block does not have
enough space and the freeblock is large enough to accomodate the
allocation.
This commit also adjusts GenerationFree() so that if we pfree the final
allocation in the current generation block, we now mark that block as
empty and keep it as the current block. Previously we free'd that block
and set the current block to NULL. Doing that meant we needed a special
case in GenerationAlloc to check if GenerationContext.block was NULL.
So this both reduces free/malloc calls and reduces the work done in
GenerationAlloc().
In passing, improve some comments in aset.c
Discussion: https://postgr.es/m/CAApHDvpHVSJqqb4B4OZLixr=CotKq-eKkbwZqvZVo_biYvUvQA@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/a0cd95448067273a5cf92ad578a1e2de3b62aa2f
Modified Files
--------------
src/backend/utils/mmgr/aset.c | 16 +-
src/backend/utils/mmgr/generation.c | 415 ++++++++++++++++++++----------------
src/backend/utils/mmgr/slab.c | 232 ++++++++++++--------
3 files changed, 386 insertions(+), 277 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Dilip Kumar | 2024-03-04 06:14:48 | Re: pgsql: Improve performance of subsystems on top of SLRU |
Previous Message | David Rowley | 2024-03-04 01:45:10 | pgsql: Support partition pruning on boolcol IS [NOT] UNKNOWN |