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 <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477252
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Konrad Sztyber 2019-12-19 09:30:50 +01:00 committed by Tomasz Zawadzki
parent 01f356ab70
commit ff001eb93f

View File

@ -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) {