Commit 0f99ab2f authored by Jim Harris's avatar Jim Harris
Browse files

thread: allocate iobuf memory based on numa_id



Signed-off-by: default avatarJim Harris <jim.harris@samsung.com>
Change-Id: I861d3683799862b0288f6b26a75ce140648f3168
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/24580


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Community CI Samsung <spdk.community.ci.samsung@gmail.com>
Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
parent 2ef611c1
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -113,15 +113,19 @@ iobuf_channel_destroy_cb(void *io_device, void *ctx)
}

static int
iobuf_node_initialize(struct iobuf_node *node)
iobuf_node_initialize(struct iobuf_node *node, uint32_t numa_id)
{
	struct spdk_iobuf_opts *opts = &g_iobuf.opts;
	struct spdk_iobuf_buffer *buf;
	uint64_t i;
	int rc;

	if (!g_iobuf.opts.enable_numa) {
		numa_id = SPDK_ENV_NUMA_ID_ANY;
	}

	node->small_pool = spdk_ring_create(SPDK_RING_TYPE_MP_MC, opts->small_pool_count,
					    SPDK_ENV_NUMA_ID_ANY);
					    numa_id);
	if (!node->small_pool) {
		SPDK_ERRLOG("Failed to create small iobuf pool\n");
		rc = -ENOMEM;
@@ -129,7 +133,7 @@ iobuf_node_initialize(struct iobuf_node *node)
	}

	node->small_pool_base = spdk_malloc(opts->small_bufsize * opts->small_pool_count, IOBUF_ALIGNMENT,
					    NULL, SPDK_ENV_NUMA_ID_ANY, SPDK_MALLOC_DMA);
					    NULL, numa_id, SPDK_MALLOC_DMA);
	if (node->small_pool_base == NULL) {
		SPDK_ERRLOG("Unable to allocate requested small iobuf pool size\n");
		rc = -ENOMEM;
@@ -137,7 +141,7 @@ iobuf_node_initialize(struct iobuf_node *node)
	}

	node->large_pool = spdk_ring_create(SPDK_RING_TYPE_MP_MC, opts->large_pool_count,
					    SPDK_ENV_NUMA_ID_ANY);
					    numa_id);
	if (!node->large_pool) {
		SPDK_ERRLOG("Failed to create large iobuf pool\n");
		rc = -ENOMEM;
@@ -145,7 +149,7 @@ iobuf_node_initialize(struct iobuf_node *node)
	}

	node->large_pool_base = spdk_malloc(opts->large_bufsize * opts->large_pool_count, IOBUF_ALIGNMENT,
					    NULL, SPDK_ENV_NUMA_ID_ANY, SPDK_MALLOC_DMA);
					    NULL, numa_id, SPDK_MALLOC_DMA);
	if (node->large_pool_base == NULL) {
		SPDK_ERRLOG("Unable to allocate requested large iobuf pool size\n");
		rc = -ENOMEM;
@@ -217,7 +221,7 @@ spdk_iobuf_initialize(void)

	IOBUF_FOREACH_NUMA_ID(i) {
		node = &g_iobuf.node[i];
		rc = iobuf_node_initialize(node);
		rc = iobuf_node_initialize(node, i);
		if (rc) {
			goto err;
		}