diff --git a/emper/Emper.hpp b/emper/Emper.hpp index bffad3df46af937a599c395f85312e2cf9fd6053..668660c899018d7013bbc9acb0afd6580e3e6a4d 100644 --- a/emper/Emper.hpp +++ b/emper/Emper.hpp @@ -61,6 +61,14 @@ enum class WorkerWakeupStrategy { static const enum WorkerWakeupStrategy WORKER_WAKEUP_STRATEGY = WorkerWakeupStrategy::EMPER_WORKER_WAKEUP_STRATEGY; +static const bool WORKER_IGNORE_WAKEUP_HINT = +#ifdef EMPER_WORKER_IGNORE_WAKEUP_HINT + true +#else + false +#endif + ; + static const bool LIBURCU = #ifdef EMPER_LIBURCU true diff --git a/emper/strategies/AbstractWorkStealingScheduler.cpp b/emper/strategies/AbstractWorkStealingScheduler.cpp index 028dd892ab742c8869ee5158c5d5cbfc4061cc95..2814a4173a3c64aece657d2239d915094a8c9e91 100644 --- a/emper/strategies/AbstractWorkStealingScheduler.cpp +++ b/emper/strategies/AbstractWorkStealingScheduler.cpp @@ -184,6 +184,10 @@ popBottom: auto* const currentWorker = Worker::getCurrentWorker(); + if constexpr (emper::WORKER_IGNORE_WAKEUP_HINT) { + goto work_stealing; + } + // Try dispatch hint possibly set by the sleep strategy if (currentWorker->dispatchHint) { const emper::FiberHint dispatchHint = currentWorker->dispatchHint; @@ -214,6 +218,7 @@ popBottom: } } +work_stealing: // Go into work stealing // TODO: Determine if there is a better value than 1/3. const float CHECK_ANYWHERE_QUEUE_AT_PERCENTAGE = 0.33; diff --git a/meson.build b/meson.build index 80b1df3f9eca4bb3c2a3f4836e65596350002cc6..71cb6c4ae58071702591b1ecd66f1cb74ec2ed53 100644 --- a/meson.build +++ b/meson.build @@ -49,6 +49,7 @@ endif conf_data.set('EMPER_WORKER_SLEEP', get_option('worker_sleep')) conf_data.set('EMPER_WORKER_WAKEUP_STRATEGY', get_option('worker_wakeup_strategy')) +conf_data.set('EMPER_WORKER_IGNORE_WAKEUP_HINT', get_option('worker_ignore_wakeup_hint')) conf_data.set('EMPER_LOCKED_WS_QUEUE', get_option('locked_ws_queue')) conf_data.set('EMPER_LOCKED_MPSC_QUEUE', get_option('locked_mpsc_queue')) conf_data.set('EMPER_OVERFLOW_QUEUE', get_option('overflow_queue')) diff --git a/meson_options.txt b/meson_options.txt index 115a5e5546fef221b255f89416dc17a6dab3977e..1b54e3de90bf82ae6625eb53800075b6d65cab06 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -65,6 +65,12 @@ option( value: 'posix', description: 'Semaphore implementation to suspend/wakeup workers', ) +option( + 'worker_ignore_wakeup_hint', + type: 'boolean', + description: 'Should possibly passed hints where to find new work be ignored', + value: false, +) option( 'locked_ws_queue', type: 'boolean',