diff options
Diffstat (limited to 'src/backend/storage')
-rw-r--r-- | src/backend/storage/buffer/bufmgr.c | 4 | ||||
-rw-r--r-- | src/backend/storage/lmgr/lwlock.c | 2 | ||||
-rw-r--r-- | src/backend/storage/lmgr/s_lock.c | 18 |
3 files changed, 13 insertions, 11 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index f402e0dd4b4..47644ea528b 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -4029,7 +4029,7 @@ rnode_comparator(const void *p1, const void *p2) uint32 LockBufHdr(BufferDesc *desc) { - SpinDelayStatus delayStatus = init_spin_delay(desc); + SpinDelayStatus delayStatus = init_local_spin_delay(); uint32 old_buf_state; while (true) @@ -4055,7 +4055,7 @@ LockBufHdr(BufferDesc *desc) static uint32 WaitBufHdrUnlocked(BufferDesc *buf) { - SpinDelayStatus delayStatus = init_spin_delay(buf); + SpinDelayStatus delayStatus = init_local_spin_delay(); uint32 buf_state; buf_state = pg_atomic_read_u32(&buf->state); diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c index bb8b8bb29f6..ddb653a06d7 100644 --- a/src/backend/storage/lmgr/lwlock.c +++ b/src/backend/storage/lmgr/lwlock.c @@ -870,7 +870,7 @@ LWLockWaitListLock(LWLock *lock) /* and then spin without atomic operations until lock is released */ { - SpinDelayStatus delayStatus = init_spin_delay(&lock->state); + SpinDelayStatus delayStatus = init_local_spin_delay(); while (old_state & LW_FLAG_LOCKED) { diff --git a/src/backend/storage/lmgr/s_lock.c b/src/backend/storage/lmgr/s_lock.c index 4a6ffb4f890..3902cbf2d96 100644 --- a/src/backend/storage/lmgr/s_lock.c +++ b/src/backend/storage/lmgr/s_lock.c @@ -70,16 +70,18 @@ static int spins_per_delay = DEFAULT_SPINS_PER_DELAY; * s_lock_stuck() - complain about a stuck spinlock */ static void -s_lock_stuck(void *p, const char *file, int line) +s_lock_stuck(const char *file, int line, const char *func) { + if (!func) + func = "(unknown)"; #if defined(S_LOCK_TEST) fprintf(stderr, - "\nStuck spinlock (%p) detected at %s:%d.\n", - p, file, line); + "\nStuck spinlock detected at %s, %s:%d.\n", + func, file, line); exit(1); #else - elog(PANIC, "stuck spinlock (%p) detected at %s:%d", - p, file, line); + elog(PANIC, "stuck spinlock detected at %s, %s:%d", + func, file, line); #endif } @@ -87,9 +89,9 @@ s_lock_stuck(void *p, const char *file, int line) * s_lock(lock) - platform-independent portion of waiting for a spinlock. */ int -s_lock(volatile slock_t *lock, const char *file, int line) +s_lock(volatile slock_t *lock, const char *file, int line, const char *func) { - SpinDelayStatus delayStatus = init_spin_delay((void *) lock); + SpinDelayStatus delayStatus = init_spin_delay(file, line, func); while (TAS_SPIN(lock)) { @@ -127,7 +129,7 @@ perform_spin_delay(SpinDelayStatus *status) if (++(status->spins) >= spins_per_delay) { if (++(status->delays) > NUM_DELAYS) - s_lock_stuck(status->ptr, status->file, status->line); + s_lock_stuck(status->file, status->line, status->func); if (status->cur_delay == 0) /* first time to delay? */ status->cur_delay = MIN_DELAY_USEC; |