From 7be3af7fa662958782d2e23989d79cc2c652b6bf Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Fri, 12 Mar 2021 15:35:56 +0100 Subject: Rate-limit scheduling of work-events In general, events are code handling some some condition, which is scheduled when such condition happened and executed independently from I/O loop. Work-events are a subgroup of events that are scheduled repeatedly until some (often significant) work is done (e.g. feeding routes to protocol). All scheduled events are executed during each I/O loop iteration. Separate work-events from regular events to a separate queue and rate limit their execution to a fixed number per I/O loop iteration. That should prevent excess latency when many work-events are scheduled at one time (e.g. simultaneous reload of many BGP sessions). --- nest/proto.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'nest') diff --git a/nest/proto.c b/nest/proto.c index 165125d8..b3c6fa47 100644 --- a/nest/proto.c +++ b/nest/proto.c @@ -252,7 +252,7 @@ channel_schedule_feed(struct channel *c, int initial) c->export_state = ES_FEEDING; c->refeeding = !initial; - ev_schedule(c->feed_event); + ev_schedule_work(c->feed_event); } static void @@ -275,7 +275,7 @@ channel_feed_loop(void *ptr) // DBG("Feeding protocol %s continued\n", p->name); if (!rt_feed_channel(c)) { - ev_schedule(c->feed_event); + ev_schedule_work(c->feed_event); return; } @@ -291,7 +291,7 @@ channel_feed_loop(void *ptr) /* Continue in feed - it will process routing table again from beginning */ c->refeed_count = 0; - ev_schedule(c->feed_event); + ev_schedule_work(c->feed_event); return; } @@ -471,7 +471,7 @@ channel_schedule_reload(struct channel *c) ASSERT(c->channel_state == CS_UP); rt_reload_channel_abort(c); - ev_schedule(c->reload_event); + ev_schedule_work(c->reload_event); } static void @@ -485,7 +485,7 @@ channel_reload_loop(void *ptr) if (!rt_reload_channel(c)) { - ev_schedule(c->reload_event); + ev_schedule_work(c->reload_event); return; } -- cgit v1.2.3