From ff001eb93fdf33a2064426e517ae6b562b1ed66c Mon Sep 17 00:00:00 2001 From: Konrad Sztyber Date: Thu, 19 Dec 2019 09:30:50 +0100 Subject: [PATCH] lib/thread: account for busy work for unregistered active pollers Treat active pollers similarly to timed ones and don't discard unregistered poller's rc. This patch is basically a copy of 7d3d2b62e but for active pollers. Change-Id: Ia85e73a6736b2924601150f8e61995eb56009c15 Signed-off-by: Konrad Sztyber Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477252 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- lib/thread/thread.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/thread/thread.c b/lib/thread/thread.c index 6de618f05..eeea5e042 100644 --- a/lib/thread/thread.c +++ b/lib/thread/thread.c @@ -520,24 +520,22 @@ spdk_thread_poll(struct spdk_thread *thread, uint32_t max_msgs, uint64_t now) poller->state = SPDK_POLLER_STATE_RUNNING; poller_rc = poller->fn(poller->arg); - if (poller->state == SPDK_POLLER_STATE_UNREGISTERED) { - TAILQ_REMOVE(&thread->active_pollers, poller, tailq); - free(poller); - continue; - } else if (poller->state != SPDK_POLLER_STATE_PAUSED) { - poller->state = SPDK_POLLER_STATE_WAITING; - } - #ifdef DEBUG if (poller_rc == -1) { SPDK_DEBUGLOG(SPDK_LOG_THREAD, "Poller %p returned -1\n", poller); } #endif + if (poller->state == SPDK_POLLER_STATE_UNREGISTERED) { + TAILQ_REMOVE(&thread->active_pollers, poller, tailq); + free(poller); + } else if (poller->state != SPDK_POLLER_STATE_PAUSED) { + poller->state = SPDK_POLLER_STATE_WAITING; + } + if (poller_rc > rc) { rc = poller_rc; } - } TAILQ_FOREACH_SAFE(poller, &thread->timer_pollers, tailq, tmp) {