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). --- lib/event.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/event.h') diff --git a/lib/event.h b/lib/event.h index 03735c3f..5f3b78d8 100644 --- a/lib/event.h +++ b/lib/event.h @@ -21,14 +21,17 @@ typedef struct event { typedef list event_list; extern event_list global_event_list; +extern event_list global_work_list; event *ev_new(pool *); void ev_run(event *); #define ev_init_list(el) init_list(el) void ev_enqueue(event_list *, event *); void ev_schedule(event *); +void ev_schedule_work(event *); void ev_postpone(event *); int ev_run_list(event_list *); +int ev_run_list_limited(event_list *, uint); static inline int ev_active(event *e) -- cgit v1.2.3