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: paul 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: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
paul luse 2021-08-05 10:58:31 -04:00 committed by Tomasz Zawadzki
parent 31e3ed5ccb
commit d09b5674a4
2 changed files with 5 additions and 8 deletions

View File

@ -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++;
}

View File

@ -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 */