Commit eb05cbd6 authored by Maciej Szwed's avatar Maciej Szwed Committed by Tomasz Zawadzki
Browse files

pollers: Fix pollers to return correct busy status



Poller should return status > 0 when it did some work
(CPU was used for some time) marking its call as busy
CPU time.

Active pollers should return BUSY status only if they
did any meangful work besides checking some conditions
(e.g. processing requests, do some complicated operations).

Signed-off-by: default avatarMaciej Szwed <maciej.szwed@intel.com>
Change-Id: Id4636a0997489b129cecfe785592cc97b50992ba
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2164


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 058be487
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -207,7 +207,7 @@ void spdk_ioat_flush(struct spdk_ioat_chan *chan);
 *
 * \param chan I/OAT channel to check for completions.
 *
 * \return 0 on success, negative errno on failure.
 * \return number of events handled on success, negative errno on failure.
 */
int spdk_ioat_process_events(struct spdk_ioat_chan *chan);

+5 −0
Original line number Diff line number Diff line
@@ -47,6 +47,11 @@
extern "C" {
#endif

enum spdk_thread_poller_rc {
	SPDK_POLLER_IDLE,
	SPDK_POLLER_BUSY,
};

/**
 * A stackless, lightweight thread.
 */
+6 −6
Original line number Diff line number Diff line
@@ -2265,7 +2265,7 @@ bdev_channel_poll_qos(void *arg)
		 *  timeslice has actually expired.  This should never happen
		 *  with a well-behaved timer implementation.
		 */
		return 0;
		return SPDK_POLLER_IDLE;
	}

	/* Reset for next round of rate limiting */
@@ -2457,7 +2457,7 @@ bdev_poll_timeout_io(void *arg)
	ctx = calloc(1, sizeof(struct poll_timeout_ctx));
	if (!ctx) {
		SPDK_ERRLOG("failed to allocate memory\n");
		return 1;
		return SPDK_POLLER_BUSY;
	}
	ctx->desc = desc;
	ctx->cb_arg = desc->cb_arg;
@@ -2476,7 +2476,7 @@ bdev_poll_timeout_io(void *arg)
			      ctx,
			      bdev_channel_poll_timeout_io_done);

	return 1;
	return SPDK_POLLER_BUSY;
}

int
@@ -3114,7 +3114,7 @@ bdev_calculate_measured_queue_depth(void *ctx)
	bdev->internal.temporary_queue_depth = 0;
	spdk_for_each_channel(__bdev_to_io_dev(bdev), _calculate_measured_qd, bdev,
			      _calculate_measured_qd_cpl);
	return 0;
	return SPDK_POLLER_BUSY;
}

void
@@ -6458,12 +6458,12 @@ bdev_lock_lba_range_check_io(void *_i)
	TAILQ_FOREACH(bdev_io, &ch->io_submitted, internal.ch_link) {
		if (bdev_io_range_is_locked(bdev_io, range)) {
			ctx->poller = SPDK_POLLER_REGISTER(bdev_lock_lba_range_check_io, i, 100);
			return 1;
			return SPDK_POLLER_BUSY;
		}
	}

	spdk_for_each_channel_continue(i, 0);
	return 1;
	return SPDK_POLLER_BUSY;
}

static void
+4 −4
Original line number Diff line number Diff line
@@ -2088,7 +2088,7 @@ _blobfs_cache_pool_reclaim(void *arg)
	int rc;

	if (!blobfs_cache_pool_need_reclaim()) {
		return 0;
		return SPDK_POLLER_IDLE;
	}

	TAILQ_FOREACH_SAFE(file, &g_caches, cache_tailq, tmp) {
@@ -2099,7 +2099,7 @@ _blobfs_cache_pool_reclaim(void *arg)
				continue;
			}
			if (!blobfs_cache_pool_need_reclaim()) {
				return 1;
				return SPDK_POLLER_BUSY;
			}
			break;
		}
@@ -2112,7 +2112,7 @@ _blobfs_cache_pool_reclaim(void *arg)
				continue;
			}
			if (!blobfs_cache_pool_need_reclaim()) {
				return 1;
				return SPDK_POLLER_BUSY;
			}
			break;
		}
@@ -2126,7 +2126,7 @@ _blobfs_cache_pool_reclaim(void *arg)
		break;
	}

	return 1;
	return SPDK_POLLER_BUSY;
}

static void
+1 −1
Original line number Diff line number Diff line
@@ -1116,7 +1116,7 @@ rpc_subsystem_init_poller_ctx(void *ctx)
		free(poller_ctx);
	}

	return 1;
	return SPDK_POLLER_BUSY;
}

static void
Loading