Re: Latches vs lwlock contention
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Yura Sokolov <y.sokolov@postgrespro.ru>,
Andres Freund <andres@anarazel.de>
Date: 2022-11-01T11:09:25Z
Lists: pgsql-hackers
Attachments
- v2-0001-Allow-palloc_extended-NO_OOM-in-critical-sections.patch (application/octet-stream) patch v2-0001
- v2-0002-Provide-SetLatches-for-batched-deferred-latches.patch (application/octet-stream) patch v2-0002
- v2-0003-Use-SetLatches-for-condition-variables.patch (application/octet-stream) patch v2-0003
- v2-0004-Use-SetLatches-for-heavyweight-locks.patch (application/octet-stream) patch v2-0004
- v2-0005-Don-t-re-acquire-LockManager-partition-lock-after.patch (application/octet-stream) patch v2-0005
- v2-0006-Use-SetLatches-for-SERIALIZABLE-DEFERRABLE-wakeup.patch (application/octet-stream) patch v2-0006
- v2-0007-Use-SetLatches-for-synchronous-replication-wakeup.patch (application/octet-stream) patch v2-0007
On Fri, Oct 28, 2022 at 4:56 PM Thomas Munro <thomas.munro@gmail.com> wrote: > See attached sketch patches. I guess the main thing that may not be > good enough is the use of a fixed sized latch buffer. Memory > allocation in don't-throw-here environments like the guts of lock code > might be an issue, which is why it just gives up and flushes when > full; maybe it should try to allocate and fall back to flushing only > if that fails. Here's an attempt at that. There aren't actually any cases of uses of this stuff in critical sections here, so perhaps I shouldn't bother with that part. The part I'd most like some feedback on is the heavyweight lock bits. I'll add this to the commitfest.
Commits
-
Fix crash if LockErrorCleanup() is called twice
- 51a0382e8d87 18.0 landed
-
Split ProcSleep function into JoinWaitQueue and ProcSleep
- 3c0fd64fec8e 18.0 landed
-
Move TRACE calls into WaitOnLock()
- 6ae0897e4241 18.0 landed
-
Set MyProc->heldLocks in ProcSleep
- 0464f25b6aa1 18.0 landed
-
Fix comment in LockReleaseAll() on when locallock->nLock can be zero
- 1fe0466cf2cb 18.0 landed
-
Allow a no-wait lock acquisition to succeed in more cases.
- 2346df6fc373 17.0 cited
-
Teach planner about more monotonic window functions
- 456fa635a909 16.0 cited