Re: Optimising latch signals

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Optimising latch signals
Date: 2020-11-19 03:49:05
Message-ID: CA+hUKG+_VG6jhEJkE+sf9Oi=3y6Jp_45HAZFaQzSk5n=_w3nuw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 13, 2020 at 12:42 PM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> 1. It's a bit clunky that pqinitmask() takes a new argument to say
> whether SIGURG should be blocked; that's because the knowledge of
> which latch implementation we're using is private to latch.c, and only
> the epoll version needs to block it. I wonder how to make that
> tidier.

I found, I think, a better way: now InitializeLatchSupport() is in
charge of managing the signal handler and modifying the signal mask.

> 3. Maybe it's strange to continue to use overloaded SIGUSR1 on
> non-epoll, non-kqueue systems; perhaps we should use SIGURG
> everywhere.

Fixed.

> The improvement isn't quite as good on Linux, because as far as I can
> tell you still have to have an (empty) signal handler installed and it
> runs (can we find a way to avoid that?), but you still get to skip all
> the pipe manipulation.

I received an off-list clue that we could use a signalfd, which I'd
discounted before because it still has to be drained; in fact the
overheads saved outweigh that so this seems like a better solution,
and I'm reliably informed that in a future WAIT_USE_IOURING mode it
should be possible to get rid of the read too, so it seems like a good
direction to go in.

I'll add this to the next commitfest.

Attachment Content-Type Size
v3-0001-Optimize-latches-to-send-fewer-signals.patch text/x-patch 3.0 KB
v3-0002-Use-SIGURG-rather-than-SIGUSR1-for-latches.patch text/x-patch 7.7 KB
v3-0003-Use-signalfd-for-epoll-latches.patch text/x-patch 10.5 KB
v3-0004-Use-EVFILT_SIGNAL-for-kqueue-latches.patch text/x-patch 5.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2020-11-19 04:11:29 Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit
Previous Message tsunakawa.takay@fujitsu.com 2020-11-19 03:45:24 RE: Disable WAL logging to speed up data loading