From 825be301152c698f4ae77c8490c00c152a1e8a2b Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Thu, 27 Jun 2024 14:25:06 +0200 Subject: [PATCH] fixup! IO: Allow to take new loops if the thread is hot, but only one at time --- sysdep/unix/io-loop.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sysdep/unix/io-loop.c b/sysdep/unix/io-loop.c index a29a922ff..0a362ce1d 100644 --- a/sysdep/unix/io-loop.c +++ b/sysdep/unix/io-loop.c @@ -706,7 +706,7 @@ birdloop_take(struct birdloop_pickup_group *group) birdloop_set_thread(loop, NULL, group); dropped++; - if (dropped * dropped > this_thread->loop_count) + if ((dropped * dropped) / 2 > this_thread->loop_count) { birdloop_leave(loop); @@ -764,10 +764,12 @@ birdloop_take(struct birdloop_pickup_group *group) } bird_thread_pickup_next(group); + + if (assign) + this_thread->meta->last_transition_ns = ns_now(); } UNLOCK_DOMAIN(attrs, group->domain); - this_thread->meta->last_transition_ns = ns_now(); } static int -- 2.47.2