From 973b3078b7f621556a692b6fdc397b5d9ac4c3ee Mon Sep 17 00:00:00 2001 From: Thomas Munro Date: Mon, 21 Oct 2019 11:05:53 +1300 Subject: [PATCH 2/2] Report time spent in posix_fallocate() as a wait event. When allocating DSM segments with posix_fallocate() on Linux (see commit 899bd785), report this activity as a wait event exactly as we would if we were using file-backed DSM rather than shm_open()-backed DSM. Author: Thomas Munro --- src/backend/storage/ipc/dsm_impl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/storage/ipc/dsm_impl.c b/src/backend/storage/ipc/dsm_impl.c index 2879b84bf6..031fd47ee5 100644 --- a/src/backend/storage/ipc/dsm_impl.c +++ b/src/backend/storage/ipc/dsm_impl.c @@ -371,10 +371,12 @@ dsm_impl_posix_resize(int fd, off_t size) * interrupt pending. This avoids the possibility of looping forever * if another backend is repeatedly trying to interrupt us. */ + pgstat_report_wait_start(WAIT_EVENT_DSM_FILL_ZERO_WRITE); do { rc = posix_fallocate(fd, 0, size); } while (rc == EINTR && !(ProcDiePending || QueryCancelPending)); + pgstat_report_wait_end(); /* * The caller expects errno to be set, but posix_fallocate() doesn't -- 2.20.1