pgsql: bufmgr: Remove freelist, always use clock-sweep - Mailing list pgsql-committers

From Andres Freund
Subject pgsql: bufmgr: Remove freelist, always use clock-sweep
Date
Msg-id E1uuZGO-000eJl-1p@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Melanie Plageman
Date:
Subject: pgsql: Add assert and log message to visibilitymap_set
Next
From: Tatsuo Ishii
Date:
Subject: pgsql: Allow to log raw parse tree.