Replace the BufMgrLock with separate locks on the lookup hashtable and
Tom Lane <tgl@sss.pgh.pa.us>
Replace the BufMgrLock with separate locks on the lookup hashtable and the freelist, plus per-buffer spinlocks that protect access to individual shared buffer headers. This requires abandoning a global freelist (since the freelist is a global contention point), which shoots down ARC and 2Q as well as plain LRU management. Adopt a clock sweep algorithm instead. Preliminary results show substantial improvement in multi-backend situations.
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/runtime.sgml | modified | +71 −36 |
| src/backend/catalog/index.c | modified | +1 −2 |
| src/backend/commands/dbcommands.c | modified | +3 −3 |
| src/backend/commands/vacuum.c | modified | +1 −2 |
| src/backend/postmaster/bgwriter.c | modified | +9 −12 |
| src/backend/storage/buffer/buf_init.c | modified | +33 −41 |
| src/backend/storage/buffer/bufmgr.c | modified | +811 −740 |
| src/backend/storage/buffer/buf_table.c | modified | +24 −14 |
| src/backend/storage/buffer/freelist.c | modified | +116 −809 |
| src/backend/storage/buffer/localbuf.c | modified | +47 −29 |
| src/backend/storage/buffer/README | modified | +139 −146 |
| src/backend/utils/misc/guc.c | modified | +27 −19 |
| src/backend/utils/misc/postgresql.conf.sample | modified | +4 −2 |
| src/backend/utils/resowner/resowner.c | modified | +2 −7 |
| src/include/postmaster/bgwriter.h | modified | +1 −3 |
| src/include/storage/buf_internals.h | modified | +82 −37 |
| src/include/storage/bufmgr.h | modified | +13 −5 |
| src/include/storage/lwlock.h | modified | +3 −2 |