Optimising latch signals

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Optimising latch signals
Date: 2020-08-09 11:48:33
Message-ID: CA+hUKGJjxPDpzBE0a3hyUywBvaZuC89yx3jK9RFZgfv_KHU7gg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

Here are some more experimental patches to reduce system calls.

0001 skips sending signals when the recipient definitely isn't
waiting, using a new flag-and-memory-barrier dance. This seems to
skip around 12% of the kill() calls for "make check", and probably
helps with some replication configurations that do a lot of
signalling. Patch by Andres (with a small memory barrier adjustment
by me).

0002 gets rid of the latch self-pipe on Linux systems.

0003 does the same on *BSD/macOS systems.

The idea for 0002 and 0003 is to use a new dedicated signal just for
latch wakeups, and keep it blocked (Linux) or ignored (BSD), except
while waiting. There may be other ways to achieve this without
bringing in a new signal, but it seemed important to leave SIGUSR1
unblocked for procsignals, and hard to figure out how to multiplex
with existing SIGUSR2 users, so for the first attempt at prototyping
this I arbitrarily chose SIGURG.

Attachment Content-Type Size
0001-Optimize-latches-to-send-fewer-signals.patch text/x-patch 2.9 KB
0002-Remove-self-pipe-in-WAIT_USE_EPOLL-builds.patch text/x-patch 11.5 KB
0003-Remove-self-pipe-in-WAIT_USE_KQUEUE-builds.patch text/x-patch 3.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2020-08-09 15:46:42 tab completion of IMPORT FOREIGN SCHEMA
Previous Message Michael Paquier 2020-08-09 11:02:52 Re: Allow CLUSTER, VACUUM FULL and REINDEX to change tablespace on the fly