Re: Fix spinlock usage in UnpinBuffer()
- From: Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>
- To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
- Cc: pgsql-patches(at)postgresql(dot)org
- Subject: Re: Fix spinlock usage in UnpinBuffer()
- Date: Wed, 28 Dec 2005 19:04:28 -0500 (EST)
- Message-id: <Pine.LNX.4.58.0512281754100.13811@eon.cs> <text/plain>
On Wed, 28 Dec 2005, Tom Lane wrote:
>
> Because the code uses _NoHoldoff, there won't be any check of
> InterruptPending in that segment of code.
I guess the danger I claimed may not really happen because of the
"ImmediateInterruptOK" variable. Since it is almost always false (except
reading inputs and some very limited local usage), so even we don't
HOLD_INTERRUPTS() in UnpinBuffer(), we are still protected by this
variable in die() when a SIGTERM sneaks in. -- But this is dangerous
AFAICS, since we must gaurantee that nowhere during holding BufHdrLock
will invoke CHECK_FOR_INTERRUPTS(), which is *not* protected by
"ImmediateInterruptOK".
In other words, if we agree that the above behavior is safe, then we can
use _NoHoldoff in almost the whole buffer manager code on condition that
we are sure that no CHECK_FOR_INTERRUPTS() invoked while holding spinlock.
So for example, in UnlockBuffers(), remove the HOLD_INTERRUPTS() pair; in
write_buffer(), change LockBufHdr() to LockBufferHdr_NoHoldoff().
Regards,
Qingqing
Home |
Main Index |
Thread Index