From: Maria Matejka Date: Fri, 31 May 2024 19:22:07 +0000 (+0200) Subject: Never allow more than 300 ms per loop X-Git-Tag: v3.0.0~192 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2705c385c074431ee8cee2fdde710de2b7da0b54;p=thirdparty%2Fbird.git Never allow more than 300 ms per loop --- diff --git a/sysdep/unix/io-loop.c b/sysdep/unix/io-loop.c index d36cbcc68..96b67e22a 100644 --- a/sysdep/unix/io-loop.c +++ b/sysdep/unix/io-loop.c @@ -817,7 +817,11 @@ bird_thread_main(void *arg) /* Compute maximal time per loop */ u64 thr_before_run = ns_now(); if (thr->loop_count > 0) + { thr->max_loop_time_ns = (thr->max_latency_ns / 2 - (thr_before_run - thr_loop_start)) / (u64) thr->loop_count; + if (thr->max_loop_time_ns > 300 MS) + thr->max_loop_time_ns = 300 MS; + } /* Run all scheduled loops */ int more_events = ev_run_list(&thr->meta->event_list);