]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Change the instruction used for a pause on arm64 (#10118)
authorAli Saidi <alisaidi@amazon.com>
Wed, 15 Jun 2022 20:08:11 +0000 (13:08 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Wed, 15 Jun 2022 20:08:11 +0000 (13:08 -0700)
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

port/port_posix.h

index 01a1a28a05d3ab072ea6cf9c61171a026a598967..d153c5817f91647f975adbac1ea6f6d6daf3afab 100644 (file)
@@ -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