From c23b129e554a76079a5e9dbb0d0f77fdda5e9a22 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 12 Feb 2022 19:33:53 +0000 Subject: [PATCH] Remove delay loop from spinlock wait. Now we halt CPU cores that are going to be idle for a lengthy period, we don't need to try to save power in other ways. And anyway, this was not very effective. --- lib/spinlock.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/spinlock.h b/lib/spinlock.h index d24016e..16530cb 100644 --- a/lib/spinlock.h +++ b/lib/spinlock.h @@ -22,7 +22,6 @@ static inline void spin_wait(spinlock_t *lock) if (lock) { while (*lock) { __builtin_ia32_pause(); - for (volatile int i = 0; i < 100; i++) { } // this reduces power consumption } } } @@ -36,7 +35,6 @@ static inline void spin_lock(spinlock_t *lock) while (!__sync_bool_compare_and_swap(lock, false, true)) { do { __builtin_ia32_pause(); - for (volatile int i = 0; i < 100; i++) { } // this reduces power consumption } while (*lock); } __sync_synchronize();