From: Ali Saidi Date: Wed, 15 Jun 2022 20:08:11 +0000 (-0700) Subject: Change the instruction used for a pause on arm64 (#10118) X-Git-Tag: v7.4.3~27 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2e5a323dbd4dbfad5b1e3d45d489e6dca37f4257;p=rocksdb.git Change the instruction used for a pause on arm64 (#10118) Summary: While the yield instruction conseptually sounds correct on most platforms it is a simple nop that doesn't delay the execution anywhere close to what an x86 pause instruction does. In other projects with spin-wait loops an isb has been observed to be much closer to the x86 behavior. On a Graviton3 system the following test improves on average by 2x with this change averaged over 20 runs: ``` ./db_bench -benchmarks=fillrandom -threads=64 -batch_size=1 -memtablerep=skip_list -value_size=100 --num=100000 level0_slowdown_writes_trigger=9999 -level0_stop_writes_trigger=9999 -disable_auto_compactions --max_write_buffer_number=8 -max_background_flushes=8 --disable_wal --write_buffer_size=160000000 --block_size=16384 --allow_concurrent_memtable_write -compression_type none ``` Pull Request resolved: https://github.com/facebook/rocksdb/pull/10118 Reviewed By: jay-zhuang Differential Revision: D37120578 fbshipit-source-id: c20bde4298222edfab7ff7cb6d42497e7012400d --- diff --git a/port/port_posix.h b/port/port_posix.h index 01a1a28a0..d153c5817 100644 --- a/port/port_posix.h +++ b/port/port_posix.h @@ -158,7 +158,7 @@ static inline void AsmVolatilePause() { #if defined(__i386__) || defined(__x86_64__) asm volatile("pause"); #elif defined(__aarch64__) - asm volatile("yield"); + asm volatile("isb"); #elif defined(__powerpc64__) asm volatile("or 27,27,27"); #endif