Re: elog(DEBUG2 in SpinLocked section.
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: michael@paquier.xyz, masao.fujii@oss.nttdata.com, amit.kapila16@gmail.com,
pasim@vmware.com, pgsql-hackers@lists.postgresql.org
Date: 2020-06-03T18:35:29Z
Lists: pgsql-hackers
Kyotaro Horiguchi <horikyota.ntt@gmail.com> writes: > I looked through 224 locations where SpinLockAcquire and found some. Yeah, I made a similar scan and arrived at about the same conclusions. I think that the memcpy and strlcpy calls are fine; at least, we've got to transport data somehow and it's not apparent why those aren't OK ways to do it. The one use of StrNCpy is annoying from a cosmetic standpoint (mainly because it's Not Like Anywhere Else) but I'm not sure it's worth changing. The condition-variable code has a boatload of spinlocked calls of the proclist functions in proclist.h. All of those are straight-line code so they're okay performance wise, but I wonder if we shouldn't add a comment to that header pointing out that its functions must not throw errors. The only other thing I remain concerned about is some instances of atomic operations inside spinlocks, which I started a separate thread about [1]. regards, tom lane [1] https://www.postgresql.org/message-id/1141819.1591208385%40sss.pgh.pa.us
Commits
-
Fix instance of elog() called while holding a spinlock
- 4a9809e34d09 9.5.23 landed
- e7a134b5817b 9.6.19 landed
- 5ed8b4a981ed 10.14 landed
- b41a85f53317 11.9 landed
- 03aa25b6e34b 12.4 landed
- c1669fd5812a 13.0 landed
-
Don't call palloc() while holding a spinlock, either.
- 3d474a07934c 12.4 landed
- f88bd3139f3e 13.0 landed
- 7a8cb4a61e7e 11.9 landed
- 0c735c686a90 10.14 landed
-
Don't call elog() while holding spinlock.
- caa3c4242cf8 13.0 landed