Kernel: Preempt Single core on redudant yields.

This commit is contained in:
Fernando Sahmkow 2020-03-10 13:13:39 -04:00
parent a439cdf22e
commit d494b074e8
6 changed files with 42 additions and 21 deletions

View file

@ -6,6 +6,7 @@
#include <functional>
#include <string>
#include <utility>
#include <vector>
#include "common/common_types.h"
@ -503,13 +504,13 @@ public:
ResultCode Sleep(s64 nanoseconds);
/// Yields this thread without rebalancing loads.
ResultCode YieldSimple();
std::pair<ResultCode, bool> YieldSimple();
/// Yields this thread and does a load rebalancing.
ResultCode YieldAndBalanceLoad();
std::pair<ResultCode, bool> YieldAndBalanceLoad();
/// Yields this thread and if the core is left idle, loads are rebalanced
ResultCode YieldAndWaitForLoadBalancing();
std::pair<ResultCode, bool> YieldAndWaitForLoadBalancing();
void IncrementYieldCount() {
yield_count++;
@ -587,7 +588,7 @@ private:
ThreadContext32 context_32{};
ThreadContext64 context_64{};
Common::SpinLock context_guard{};
std::shared_ptr<Common::Fiber> host_context{};
std::shared_ptr<Common::Fiber> host_context{};
u64 thread_id = 0;