From 94c099e2e8bad4886ee5c9a00ab01a4ee945348b Mon Sep 17 00:00:00 2001 From: Florian Schmaus <flow@cs.fau.de> Date: Tue, 18 May 2021 18:54:45 +0200 Subject: [PATCH] Add check_anywhere_queue_while_stealing meson option --- emper/Emper.hpp | 8 ++++++++ emper/strategies/AbstractWorkStealingScheduler.cpp | 2 ++ meson.build | 1 + meson_options.txt | 6 ++++++ 4 files changed, 17 insertions(+) diff --git a/emper/Emper.hpp b/emper/Emper.hpp index aae69952..3fb17133 100644 --- a/emper/Emper.hpp +++ b/emper/Emper.hpp @@ -78,6 +78,14 @@ static const bool OVERFLOW_QUEUE = #endif ; +static const bool CHECK_ANYWHERE_QUEUE_WHILE_STEALING = +#ifdef EMPER_CHECK_ANYWHERE_QUEUE_WHILE_STEALING + true +#else + false +#endif + ; + auto getFullVersion() -> std::string; static const bool BLOCKED_CONTEXT_SET = diff --git a/emper/strategies/AbstractWorkStealingScheduler.cpp b/emper/strategies/AbstractWorkStealingScheduler.cpp index 67e06979..ca42b9c9 100644 --- a/emper/strategies/AbstractWorkStealingScheduler.cpp +++ b/emper/strategies/AbstractWorkStealingScheduler.cpp @@ -205,6 +205,8 @@ popBottom: auto stolenFiber = tryStealFiberFrom(victim); if (stolenFiber) return *stolenFiber; + if constexpr (!emper::CHECK_ANYWHERE_QUEUE_WHILE_STEALING) continue; + // If we failed to steal from a certain number of victims, check // the anywhere queue for new fibers. if (i == checkAnywhereQueueAt) { diff --git a/meson.build b/meson.build index 1256b288..52f6063f 100644 --- a/meson.build +++ b/meson.build @@ -37,6 +37,7 @@ conf_data.set('EMPER_WORKER_WAKEUP_STRATEGY', get_option('worker_wakeup_strategy 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')) +conf_data.set('EMPER_CHECK_ANYWHERE_QUEUE_WHILE_STEALING', get_option('check_anywhere_queue_while_stealing')) conf_data.set('EMPER_STATS', get_option('stats')) conf_data.set('EMPER_OVERFLOW_QUEUE', get_option('overflow_queue')) conf_data.set('EMPER_BLOCKED_CONTEXT_SET', get_option('blocked_context_set')) diff --git a/meson_options.txt b/meson_options.txt index 1a719c0e..a9fb6266 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -98,6 +98,12 @@ option( value: true, description: 'Use an overflow queue in case scheduling queues become full', ) +option( + 'check_anywhere_queue_while_stealing', + type: 'boolean', + value: true, + description: 'Check the anywhere queue after some failed stealed attempts', +) option( 'io', type: 'boolean', -- GitLab