Commit d09b5674 authored by paul luse's avatar paul luse Committed by Tomasz Zawadzki
Browse files

lib/idxd: reduce size of per channel batch pool



Was set at a pretty high number during early development.
Instead of a #define, lets use the same math we use to
determine the size of the operation and descriptor pools as
that's the max number of batches that will be needed.

Signed-off-by: default avatarpaul luse <paul.e.luse@intel.com>
Change-Id: Ide5311b4b6c931010413d0f82baed0e05d5fcde7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9099


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 31e3ed5c
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ spdk_idxd_get_channel(struct spdk_idxd_device *idxd)
{
	struct spdk_idxd_io_channel *chan;
	struct idxd_batch *batch;
	int i;
	int i, num_batches;

	assert(idxd != NULL);

@@ -105,7 +105,9 @@ spdk_idxd_get_channel(struct spdk_idxd_device *idxd)
		return NULL;
	}

	chan->batch_base = calloc(NUM_BATCHES_PER_CHANNEL, sizeof(struct idxd_batch));
	num_batches = idxd->queues[idxd->wq_id].wqcfg.wq_size / idxd->chan_per_device;

	chan->batch_base = calloc(num_batches, sizeof(struct idxd_batch));
	if (chan->batch_base == NULL) {
		SPDK_ERRLOG("Failed to allocate batch pool\n");
		free(chan);
@@ -134,7 +136,7 @@ spdk_idxd_get_channel(struct spdk_idxd_device *idxd)
	TAILQ_INIT(&chan->ops_outstanding);

	batch = chan->batch_base;
	for (i = 0 ; i < NUM_BATCHES_PER_CHANNEL ; i++) {
	for (i = 0 ; i < num_batches ; i++) {
		TAILQ_INSERT_TAIL(&chan->batch_pool, batch, link);
		batch++;
	}
+0 −5
Original line number Diff line number Diff line
@@ -65,11 +65,6 @@ static inline void movdir64b(void *dst, const void *src)
/* The following sets up a max desc count per batch of 16 */
#define LOG2_WQ_MAX_BATCH	4  /* 2^4 = 16 */
#define DESC_PER_BATCH		(1 << LOG2_WQ_MAX_BATCH)
/* We decide how many batches we want to support based on what max queue
 * depth makes sense resource wise. There is a small price to pay with
 * larger numbers wrt polling for completions.
 */
#define NUM_BATCHES_PER_CHANNEL	0x400
#define MIN_USER_DESC_COUNT	2

#define LOG2_WQ_MAX_XFER	30 /* 2^30 = 1073741824 */