From: Nadav Har'El <[email protected]>
Committer: Nadav Har'El <[email protected]>
Branch: master

sched: make export_runtime() idempotent

Allow running export_runtime() twice without ill-effect.
A following patch will allow migrating sleeping threads, and migrating it
again before it got to run is possible.

Signed-off-by: Nadav Har'El <[email protected]>
Message-Id: <[email protected]>

---
diff --git a/core/sched.cc b/core/sched.cc
--- a/core/sched.cc
+++ b/core/sched.cc
@@ -1472,8 +1472,10 @@ size_t kernel_tls_size()

 void thread_runtime::export_runtime()
 {
-    _Rtt /= cpu::current()->c;;
-    _renormalize_count = -1; // special signal to update_after_sleep()
+    if (_renormalize_count != -1) {
+        _Rtt /= cpu::current()->c;;
+        _renormalize_count = -1; // special signal to update_after_sleep()
+    }
 }

 void thread_runtime::update_after_sleep()

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to