Skip to content

Commit

Permalink
utils: don't set realtime scheduling again if we already tried
Browse files Browse the repository at this point in the history
Signed-off-by: Yuxuan Shui <[email protected]>
  • Loading branch information
yshui committed Mar 3, 2024
1 parent a7b6e8c commit a2e6444
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ void rolling_quantile_pop_front(struct rolling_quantile *rq, int x) {
/// This requires the user to set up permissions for the real-time scheduling. e.g. by
/// setting `ulimit -r`, or giving us the CAP_SYS_NICE capability.
void set_rr_scheduling(void) {
static thread_local bool already_tried = false;
if (already_tried) {
return;

Check warning on line 287 in src/utils.c

View check run for this annotation

Codecov / codecov/patch

src/utils.c#L286-L287

Added lines #L286 - L287 were not covered by tests
}
already_tried = true;

Check warning on line 289 in src/utils.c

View check run for this annotation

Codecov / codecov/patch

src/utils.c#L289

Added line #L289 was not covered by tests

int priority = sched_get_priority_min(SCHED_RR);

if (rtkit_make_realtime(0, priority)) {
Expand Down

0 comments on commit a2e6444

Please sign in to comment.