From 31289436f5ccf0d5d17a77087135d16430761e3d Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Sun, 7 Feb 2021 23:52:06 -0800 Subject: [PATCH] [kernel] Use PAUSE in spinwait Using PAUSE in a tight loop allows other logical cores on the same physical core to make use of more of the core's resources. --- src/kernel/clock.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kernel/clock.cpp b/src/kernel/clock.cpp index 44e1976..cca852a 100644 --- a/src/kernel/clock.cpp +++ b/src/kernel/clock.cpp @@ -17,6 +17,6 @@ void clock::spinwait(uint64_t us) const { uint64_t when = value() + us; - while (value() < when); + while (value() < when) asm ("pause"); }