[PATCH] reactor: Allow disable/enable of stall detector from code

4 views
Skip to first unread message

Calle Wilund

<calle@scylladb.com>
unread,
Dec 12, 2018, 5:19:11 AM12/12/18
to seastar-dev@googlegroups.com, Calle Wilund
---
include/seastar/core/reactor.hh | 2 ++
src/core/reactor.cc | 6 +++++-
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/seastar/core/reactor.hh b/include/seastar/core/reactor.hh
index 5336c28c..fc4f6b36 100644
--- a/include/seastar/core/reactor.hh
+++ b/include/seastar/core/reactor.hh
@@ -849,6 +849,7 @@ class reactor {
pthread_t _thread_id alignas(seastar::cache_line_size) = pthread_self();
bool _strict_o_direct = true;
bool _bypass_fsync = false;
+ bool _blocked_reactor_notify_active = true;
bool& _local_need_preempt{g_need_preempt}; // for access from the _task_quota_timer_thread
std::thread _task_quota_timer_thread;
std::atomic<bool> _dying{false};
@@ -1181,6 +1182,7 @@ class reactor {
}

void update_blocked_reactor_notify_ms(std::chrono::milliseconds ms);
+ void set_blocked_reactor_notify_active(bool);
};

template <typename Func> // signature: bool ()
diff --git a/src/core/reactor.cc b/src/core/reactor.cc
index f35883c7..d48d4fda 100644
--- a/src/core/reactor.cc
+++ b/src/core/reactor.cc
@@ -713,7 +713,7 @@ reactor::task_quota_timer_thread_fn() {
auto tp = _tasks_processed.load(std::memory_order_relaxed);
auto p = _polls.load(std::memory_order_relaxed);
if ((tp == last_tasks_processed_seen) && (p == last_polls_seen)) {
- if ((increment_nonatomically(_tasks_processed_stalled) == report_at)) {
+ if (_blocked_reactor_notify_active && (increment_nonatomically(_tasks_processed_stalled) == report_at)) {
rate_limit.maybe_report(_thread_id, block_notifier_signal());
report_at <<= 1;
}
@@ -737,6 +737,10 @@ reactor::update_blocked_reactor_notify_ms(std::chrono::milliseconds ms) {
seastar_logger.info("updated: blocked-reactor-notify-ms={}", ms.count());
}
}
+void
+reactor::set_blocked_reactor_notify_active(bool active) {
+ _blocked_reactor_notify_active = active;
+}

void
reactor::block_notifier(int) {
--
2.14.3

Reply all
Reply to author
Forward
0 new messages