postgresql/src/include/storage
Andres Freund 09bff91b31 Avoid potential spinlock in a signal handler as part of global barriers.
On platforms without support for 64bit atomic operations where we also
cannot rely on 64bit reads to have single copy atomicity, such atomics
are implemented using a spinlock based fallback. That means it's not
safe to even read such atomics from within a signal handler (since the
signal handler might run when the spinlock already is held).

To avoid this issue defer global barrier processing out of the signal
handler. Instead of checking local / shared barrier generation to
determine whether to set ProcSignalBarrierPending, introduce
PROCSIGNAL_BARRIER and always set ProcSignalBarrierPending when
receiving such a signal. Additionally avoid redundant work in
ProcessProcSignalBarrier if ProcSignalBarrierPending is unnecessarily.

Also do a small amount of other polishing.

Author: Andres Freund
Reviewed-By: Robert Haas
Discussion: https://postgr.es/m/20200609193723.eu5ilsjxwdpyxhgz@alap3.anarazel.de
Backpatch: 13-, where the code was introduced.
2020-06-17 12:47:13 -07:00
..
.gitignore When trace_lwlocks is used, identify individual lwlocks by name. 2015-09-11 14:01:39 -04:00
backendid.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
barrier.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
block.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
buf.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
buf_internals.h Support PrefetchBuffer() in recovery. 2020-04-08 14:56:57 +12:00
buffile.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
bufmgr.h Support PrefetchBuffer() in recovery. 2020-04-08 14:56:57 +12:00
bufpage.h Add declaration-level assertions for compile-time checks 2020-02-03 14:48:42 +09:00
checksum.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
checksum_impl.h Fix page-level checksum calculation in checksum_impl.h 2020-03-06 08:15:29 +09:00
condition_variable.h Spelling adjustments 2020-06-07 15:06:51 +02:00
copydir.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
dsm.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
dsm_impl.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
fd.h Remove HAVE_WORKING_LINK 2020-03-11 11:23:04 +01:00
freespace.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
fsm_internals.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
indexfsm.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
ipc.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
item.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
itemid.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
itemptr.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
large_object.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
latch.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
lmgr.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
lock.h Skip WAL for new relfilenodes, under wal_level=minimal. 2020-04-04 12:25:34 -07:00
lockdefs.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
lwlock.h Drop the redundant "Lock" suffix from LWLock wait event names. 2020-05-15 19:55:56 -04:00
md.h Support PrefetchBuffer() in recovery. 2020-04-08 14:56:57 +12:00
off.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pg_sema.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pg_shmem.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pmsignal.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
predicate.h Rename SLRU structures and associated LWLocks. 2020-05-15 14:28:25 -04:00
predicate_internals.h Rename assorted LWLock tranches. 2020-05-15 18:11:07 -04:00
proc.h Rename assorted LWLock tranches. 2020-05-15 18:11:07 -04:00
procarray.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
proclist.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
proclist_types.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
procsignal.h Avoid potential spinlock in a signal handler as part of global barriers. 2020-06-17 12:47:13 -07:00
reinit.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
relfilenode.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
s_lock.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
sharedfileset.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
shm_mq.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
shm_toc.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
shmem.h Initial pgindent and pgperltidy run for v13. 2020-05-14 13:06:50 -04:00
sinval.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
sinvaladt.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
smgr.h Remove smgrdounlink() in smgr.c from the code tree 2020-05-10 10:58:54 +09:00
spin.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
standby.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
standbydefs.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
sync.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00