From 054708dab89a5519dcc2e6cb3112a6cddc4a8514 Mon Sep 17 00:00:00 2001 From: Kai Krakow Date: Sun, 17 Nov 2019 17:55:28 +0100 Subject: [PATCH] crucible: Schedule loadavg calculator as fast as possible We want the loadavg calculation to be almost real-time. If SCHED_ISO is not supported, it will use whatever the service was started with (SCHED_OTHER by default). Signed-off-by: Kai Krakow --- lib/task.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/task.cc b/lib/task.cc index 716ebebe..cbd20bbb 100644 --- a/lib/task.cc +++ b/lib/task.cc @@ -594,6 +594,8 @@ namespace crucible { void TaskMasterState::loadavg_thread_fn() { + sched_param param = { .sched_priority = 0 }; + pthread_setschedparam(pthread_self(), SCHED_ISO, ¶m); pthread_setname_np(pthread_self(), "load_tracker"); while (!m_cancelled) { adjust_thread_count();