pgsql: bufmgr: Remove freelist, always use clock-sweep

Started by Andres Freund11 months ago1 messagescomitters
Jump to latest
#1Andres Freund
andres@anarazel.de

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: /messages/by-id/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(-)