Skip to content
Snippets Groups Projects
Commit da96e449 authored by Florian Schmaus's avatar Florian Schmaus
Browse files

Merge branch 'configurable_worker_wakeup' into 'master'

make worker wakeup strategy compile time configurable

See merge request i4/manycore/emper!61
parents cc870db9 51d1518d
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,14 @@ static const bool WORKER_SLEEP =
false
#endif
;
enum class WorkerWakeupStrategy { one, all };
static const enum WorkerWakeupStrategy WORKER_WAKEUP_STRATEGY =
#ifdef EMPER_WORKER_WAKEUP_ALL
WorkerWakeupStrategy::all
#else
WorkerWakeupStrategy::one
#endif
;
static const bool LIBURCU =
#ifdef EMPER_LIBURCU
......
......@@ -17,6 +17,7 @@
#include "Common.hpp" // for ALIGN_TO_CACHE_LINE
#include "Debug.hpp" // for LogSubsystem, LogSubsystem::RUNTI, Logger
#include "Emper.hpp" // for WORKER_NOTIFY
#include "Scheduler.hpp" // for Scheduler
#include "Worker.hpp"
#include "emper-common.h" // for workerid_t
......@@ -86,8 +87,13 @@ class Runtime : public Logger<LogSubsystem::RUNTI> {
std::lock_guard<std::mutex> lk(workerSleepMutex);
skipSleep = true;
sleepingWorkers.fetch_sub(1, std::memory_order_relaxed);
workerSleepConditionVariable.notify_one();
if constexpr (emper::WORKER_WAKEUP_STRATEGY == emper::WorkerWakeupStrategy::all) {
sleepingWorkers.store(0, std::memory_order_relaxed);
workerSleepConditionVariable.notify_all();
} else {
sleepingWorkers.fetch_sub(1, std::memory_order_relaxed);
workerSleepConditionVariable.notify_one();
}
}
void dispatcherLoopSleep() {
......
......@@ -26,6 +26,7 @@ if option_urcu
endif
conf_data.set('EMPER_WORKER_SLEEP', get_option('worker_sleep'))
conf_data.set('EMPER_WORKER_WAKEUP_ALL', get_option('worker_wakeup_strategy') == 'all')
conf_data.set('EMPER_LOCKED_WS_QUEUE', get_option('locked_ws_queue'))
conf_data.set('EMPER_OVERFLOW_QUEUE', get_option('overflow_queue'))
conf_data.set('EMPER_LOCKED_MPSC_QUEUE', get_option('locked_mpsc_queue'))
......
......@@ -16,6 +16,13 @@ option(
value: true,
description: 'Enable sleeping worker support',
)
option(
'worker_wakeup_strategy',
type: 'combo',
description: 'How many workers should be signaled onNewWork',
choices: ['one', 'all'],
value: 'one',
)
option(
'locked_ws_queue',
type: 'boolean',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment