aboutsummaryrefslogtreecommitdiff
path: root/src/chunklets/fastspin.c
diff options
context:
space:
mode:
authorGravatar Michael Smith <mikesmiffy128@gmail.com> 2026-10-11 00:47:00 +0100
committerGravatar Michael Smith <mikesmiffy128@gmail.com> 2026-10-11 00:47:00 +0100
commit2986be1dd50be033cd8573afd544fc164bd12bc7 (patch)
treeab55956fc2ab57e2a30d50ed4985b37aa379dbc2 /src/chunklets/fastspin.c
parent5f0bf6dbf6291fbbbcf6db00eccde479f99a5608 (diff)
downloadsst-2986be1dd50be033cd8573afd544fc164bd12bc7.tar.gz
sst-2986be1dd50be033cd8573afd544fc164bd12bc7.zip
Spin way less before futexing in fastspin
According to some reading I did recently on hybrid locks, a value of around 40 is optimal, or at least was at one point. It might have changed in more recent years and I have by no means made any effort to tune the value, but it seems clear that 1000 is way too high.
Diffstat (limited to 'src/chunklets/fastspin.c')
-rw-r--r--src/chunklets/fastspin.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/chunklets/fastspin.c b/src/chunklets/fastspin.c
index d349395..c61d781 100644
--- a/src/chunklets/fastspin.c
+++ b/src/chunklets/fastspin.c
@@ -236,7 +236,7 @@ int fastspin_wait(volatile int *p_) {
#else
if (x > 0) return x;
if (!x) {
- for (int c = 1000; c; --c) {
+ for (int c = 40; c; --c) {
x = atomic_load_explicit(p, memory_order_relaxed);
RELAX();
if (x > 0) return x;
@@ -269,7 +269,7 @@ top: x = 0;
return;
}
if (x) {
- for (int c = 1000; c; --c) {
+ for (int c = 40; c; --c) {
x = atomic_load_explicit(p, memory_order_relaxed);
RELAX();
// note: top sets x to 0 unnecessarily but clang actually does