From f1595ce43940e9cc6f5052b77b6f5152bc251f8b Mon Sep 17 00:00:00 2001 From: Duncan Eastoe Date: Tue, 22 Dec 2020 18:35:40 +0000 Subject: [PATCH] zebra: resched dp thread if output queue limit hit If the dataplane thread hits the work limit while processing the output queue for any given provider, we now explicitly reschedule the thread. Otherwise, if the number of items in the output queue is greater than the work limit, draining of that output queue is dependent on new dataplane work. Routes which are not drained from the output queue are stuck with the 'q' flag, so this is a similar issue to that observed in 164d8e86081fdf33992b6c45af446bac6103e20c. Signed-off-by: Duncan Eastoe --- zebra/zebra_dplane.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index ddab2b8742..da7f4cf64e 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -4537,6 +4537,7 @@ static int dplane_thread_loop(struct thread *event) struct zebra_dplane_ctx *ctx, *tctx; int limit, counter, error_counter; uint64_t curr, high; + bool reschedule = false; /* Capture work limit per cycle */ limit = zdplane_info.dg_updates_per_cycle; @@ -4673,6 +4674,9 @@ static int dplane_thread_loop(struct thread *event) dplane_provider_unlock(prov); + if (counter >= limit) + reschedule = true; + if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) zlog_debug("dplane dequeues %d completed work from provider %s", counter, dplane_provider_get_name(prov)); @@ -4683,6 +4687,13 @@ static int dplane_thread_loop(struct thread *event) DPLANE_UNLOCK(); } + /* + * We hit the work limit while processing at least one provider's + * output queue - ensure we come back and finish it. + */ + if (reschedule) + dplane_provider_work_ready(); + /* After all providers have been serviced, enqueue any completed * work and any errors back to zebra so it can process the results. */