summaryrefslogtreecommitdiff
path: root/nest/proto.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2021-03-12 15:35:56 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2021-03-12 15:35:56 +0100
commit7be3af7fa662958782d2e23989d79cc2c652b6bf (patch)
treeaeecb3e36af55eb4367f0b5218e3301d6383808e /nest/proto.c
parent9cf3d533110313d55b60d47c134f1b7050d6be78 (diff)
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).
Diffstat (limited to 'nest/proto.c')
-rw-r--r--nest/proto.c10
1 files changed, 5 insertions, 5 deletions
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;
}