Skip to content

Commit

Permalink
crucible: Schedule loadavg calculator as fast as possible
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
kakra committed Nov 30, 2021
1 parent e795d87 commit 054708d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/task.cc
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,8 @@ namespace crucible {
void
TaskMasterState::loadavg_thread_fn()
{
sched_param param = { .sched_priority = 0 };
pthread_setschedparam(pthread_self(), SCHED_ISO, &param);
pthread_setname_np(pthread_self(), "load_tracker");
while (!m_cancelled) {
adjust_thread_count();
Expand Down

0 comments on commit 054708d

Please sign in to comment.