Re: Replace buffer I/O locks with condition variables (reviving an old patch)

Thomas Munro <thomas.munro@gmail.com>

From: Thomas Munro <thomas.munro@gmail.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Robert Haas <robertmhaas@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2021-03-04T23:12:36Z
Lists: pgsql-hackers

Attachments

On Fri, Feb 26, 2021 at 7:08 PM Thomas Munro <thomas.munro@gmail.com> wrote:
> Back in 2016, Robert Haas proposed to replace I/O locks with condition
> variables[1].  Condition variables went in and have found lots of
> uses, but this patch to replace a bunch of LWLocks and some busy
> looping did not.  Since then, it has been tested quite a lot as part
> of the AIO project[2], which currently depends on it.  That's why I'm
> interested in following up now.  I asked Robert if he planned to
> re-propose it and he said I should go for it, so... here I go.

I removed a redundant (Size) cast, fixed the wait event name and
category (WAIT_EVENT_BUFFILE_XXX is for buffile.c stuff, not bufmgr.c
stuff, and this is really an IPC wait, not an IO wait despite the
name), updated documentation and pgindented.

Commits

  1. Improve comment for struct BufferDesc.

  2. Replace buffer I/O locks with condition variables.

  3. Move buffer I/O and content LWLocks out of the main tranche.