diff --git a/emper/MemoryManager.hpp b/emper/MemoryManager.hpp index c25d0ab8eed9252a295cdfb88a05c088bab059fb..d9572eb7f13a978e86340844c5b070ae5202475c 100644 --- a/emper/MemoryManager.hpp +++ b/emper/MemoryManager.hpp @@ -40,12 +40,13 @@ class MemoryManager { if (likely(poped)) return memory; // Fallback to memory-stealing. + const workerid_t myWorkerId = Runtime::getWorkerId(); const workerid_t startWorkerId = Runtime::rand() % workerCount; for (workerid_t i = 0; i < workerCount; ++i) { workerid_t victim = (startWorkerId + i) % workerCount; // Don't steal from ourselves. - if (unlikely(victim == Runtime::getWorkerId())) continue; + if (unlikely(victim == myWorkerId)) continue; poped = queues[victim]->popTop(&memory); if (poped) return memory; diff --git a/emper/strategies/laws/LawsScheduler.cpp b/emper/strategies/laws/LawsScheduler.cpp index 6473407ada3a5678e271f414d834ba53a88237fc..75f8d4684fb1ebeb80ebca896b705a0686430d6c 100644 --- a/emper/strategies/laws/LawsScheduler.cpp +++ b/emper/strategies/laws/LawsScheduler.cpp @@ -102,7 +102,7 @@ auto LawsScheduler::nextFiber() -> Fiber* { poped = queues[victim]->popTop(&fiber); if (poped) { - if (emper::STATS) { + if constexpr (emper::STATS) { auto flag = static_cast<unsigned int>(LawsStrategy::FiberSource::stolen); fiber->setFlag(flag); } diff --git a/emper/strategies/ws/WsScheduler.cpp b/emper/strategies/ws/WsScheduler.cpp index 38636e34f04c111f3382152970ae03e68d1a6f38..2cb8a1d16a7dc475286428a516f1c1bf4ed9dd29 100644 --- a/emper/strategies/ws/WsScheduler.cpp +++ b/emper/strategies/ws/WsScheduler.cpp @@ -54,6 +54,7 @@ auto WsScheduler::nextFiber() -> Fiber* { return fiber; } + const workerid_t myWorkerId = Runtime::getWorkerId(); const workerid_t workerCount = runtime.getWorkerCount(); workerid_t startWorkerId = Runtime::rand() % workerCount; // TODO: See how reducing the loop bound affects things. @@ -61,7 +62,7 @@ auto WsScheduler::nextFiber() -> Fiber* { workerid_t victim = (startWorkerId + i) % workerCount; // Don't steal from ourselves. - if (unlikely(victim == Runtime::getWorkerId())) continue; + if (unlikely(victim == myWorkerId)) continue; poped = queues[victim]->popTop(&fiber); if (poped) {