Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3d0b4b1

Browse files
Use a non-locking initial test in TAS_SPIN on AArch64.
Our testing showed that this is helpful at sufficiently highcontention levels and doesn't hurt performance on smaller machines.The new TAS_SPIN macro for AArch64 is identical to the ones addedfor PPC and x86_64 (see commitsbc2a050 andb03d196).Reported-by: Salvatore DipietroReviewed-by: Jingtang Zhang, Andres FreundTested-by: Tom LaneDiscussion:https://postgr.es/m/ZxgDEb_VpWyNZKB_%40nathan
1 parent28e7a99 commit3d0b4b1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

‎src/include/storage/s_lock.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,18 +263,24 @@ tas(volatile slock_t *lock)
263263

264264
#defineS_UNLOCK(lock) __sync_lock_release(lock)
265265

266+
#if defined(__aarch64__)
267+
266268
/*
267-
* Using an ISB instruction to delay in spinlock loops appears beneficial on
268-
* high-core-count ARM64 processors. It seems mostly a wash for smaller gear,
269-
* and ISB doesn't exist at all on pre-v7 ARM chips.
269+
* On ARM64, it's a win to use a non-locking test before the TAS proper. It
270+
* may be a win on 32-bit ARM, too, but nobody's tested it yet.
270271
*/
271-
#if defined(__aarch64__)
272+
#defineTAS_SPIN(lock)(*(lock) ? 1 : TAS(lock))
272273

273274
#defineSPIN_DELAY() spin_delay()
274275

275276
static __inline__void
276277
spin_delay(void)
277278
{
279+
/*
280+
* Using an ISB instruction to delay in spinlock loops appears beneficial
281+
* on high-core-count ARM64 processors. It seems mostly a wash for smaller
282+
* gear, and ISB doesn't exist at all on pre-v7 ARM chips.
283+
*/
278284
__asm__ __volatile__(
279285
" isb;\n");
280286
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp