pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: bufmgr: Remove freelist, always use clock-sweep
Date: Fri, 05 Sep 2025 16:26:12 +0000
Message-ID: <E1uuZGO-000eJl-1p@gemulon.postgresql.org> (raw)

bufmgr: Remove freelist, always use clock-sweep

This set of changes removes the list of available buffers and instead simply
uses the clock-sweep algorithm to find and return an available buffer.  This
also removes the have_free_buffer() function and simply caps the
pg_autoprewarm process to at most NBuffers.

While on the surface this appears to be removing an optimization it is in fact
eliminating code that induces overhead in the form of synchronization that is
problematic for multi-core systems.

The main reason for removing the freelist, however, is not the moderate
improvement in scalability, but that having the freelist would require
dedicated complexity in several upcoming patches. As we have not been able to
find a case benefiting from the freelist...

Author: Greg Burd <greg@burd.me>
Reviewed-by: Tomas Vondra <tomas@vondra.me>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/70C6A5B5-2A20-4D0B-BC73-EB09DD62D61C@getmailspring.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2c789405275928ce0d2ceb7c4add91d27df92502

Modified Files
--------------
contrib/pg_prewarm/autoprewarm.c      |  30 ++++-----
src/backend/storage/buffer/README     |  40 ++++--------
src/backend/storage/buffer/buf_init.c |   9 ---
src/backend/storage/buffer/bufmgr.c   |  29 +--------
src/backend/storage/buffer/freelist.c | 119 +---------------------------------
src/include/storage/buf_internals.h   |  13 +---
6 files changed, 31 insertions(+), 209 deletions(-)



Message-ID: <E1uuZGO-000eJl-1p@gemulon.postgresql.org>
Permalink:  ../E1uuZGO-000eJl-1p@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uuZGO-000eJl-1p@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: bufmgr: Remove freelist, always use clock-sweep
  In-Reply-To: <E1uuZGO-000eJl-1p@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox