Commit 186b109d authored by Jim Harris's avatar Jim Harris Committed by Konrad Sztyber
Browse files

env: add SPDK_ENV_NUMA_ID_ANY and replace socket_id with numa_id



We will try to avoid further proliferation of "SOCKET_ID" to refer
to a NUMA socket ID moving forward, and just use "NUMA_ID" to avoid
confusion with TCP sockets.

Change all of the existing in-tree SPDK_ENV_SOCKET_ID_ANY uses to
SPDK_ENV_NUMA_ID_ANY, but keep the old #define around, at least for
now. Also change all 'socket_id' parameters to 'numa_id'.

We still have spdk_env_get_socket_id(), we will need to keep this
but next patch will add spdk_env_get_numa_id().

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


Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Community-CI: Mellanox Build Bot
parent 9475ec8d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -459,12 +459,12 @@ associate_workers_with_chan(void)
						   g_user_config.queue_depth * 2, /* src + dst */
						   g_user_config.xfer_size_bytes,
						   SPDK_MEMPOOL_DEFAULT_CACHE_SIZE,
						   SPDK_ENV_SOCKET_ID_ANY);
						   SPDK_ENV_NUMA_ID_ANY);
		t->task_pool = spdk_mempool_create(task_pool_name,
						   g_user_config.queue_depth,
						   sizeof(struct ioat_task),
						   SPDK_MEMPOOL_DEFAULT_CACHE_SIZE,
						   SPDK_ENV_SOCKET_ID_ANY);
						   SPDK_ENV_NUMA_ID_ANY);
		if (!t->data_pool || !t->task_pool) {
			fprintf(stderr, "Could not allocate buffer pool.\n");
			spdk_mempool_free(t->data_pool);
+2 −2
Original line number Diff line number Diff line
@@ -310,11 +310,11 @@ work_fn(void *arg)
	snprintf(task_pool_name, sizeof(task_pool_name), "task_pool_%u", t->lcore_id);
	t->data_pool = spdk_mempool_create(buf_pool_name, g_user_config.queue_depth, SRC_BUFFER_SIZE,
					   SPDK_MEMPOOL_DEFAULT_CACHE_SIZE,
					   SPDK_ENV_SOCKET_ID_ANY);
					   SPDK_ENV_NUMA_ID_ANY);
	t->task_pool = spdk_mempool_create(task_pool_name, g_user_config.queue_depth,
					   sizeof(struct ioat_task),
					   SPDK_MEMPOOL_DEFAULT_CACHE_SIZE,
					   SPDK_ENV_SOCKET_ID_ANY);
					   SPDK_ENV_NUMA_ID_ANY);
	if (!t->data_pool || !t->task_pool) {
		fprintf(stderr, "Could not allocate buffer pool.\n");
		t->init_failed = true;
+1 −1
Original line number Diff line number Diff line
@@ -1112,7 +1112,7 @@ main(int argc, char **argv)
	task_count *= g_arbitration.queue_depth;

	task_pool = spdk_mempool_create(task_pool_name, task_count,
					sizeof(struct arb_task), 0, SPDK_ENV_SOCKET_ID_ANY);
					sizeof(struct arb_task), 0, SPDK_ENV_NUMA_ID_ANY);
	if (task_pool == NULL) {
		fprintf(stderr, "could not initialize task pool\n");
		rc = 1;
+2 −2
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ write_complete(void *arg, const struct spdk_nvme_cpl *completion)
	} else {
		spdk_free(sequence->buf);
	}
	sequence->buf = spdk_zmalloc(0x1000, 0x1000, NULL, SPDK_ENV_SOCKET_ID_ANY, SPDK_MALLOC_DMA);
	sequence->buf = spdk_zmalloc(0x1000, 0x1000, NULL, SPDK_ENV_NUMA_ID_ANY, SPDK_MALLOC_DMA);

	rc = spdk_nvme_ns_cmd_read(ns_entry->ns, ns_entry->qpair, sequence->buf,
				   0, /* LBA start */
@@ -210,7 +210,7 @@ hello_world(void)
		sequence.buf = spdk_nvme_ctrlr_map_cmb(ns_entry->ctrlr, &sz);
		if (sequence.buf == NULL || sz < 0x1000) {
			sequence.using_cmb_io = 0;
			sequence.buf = spdk_zmalloc(0x1000, 0x1000, NULL, SPDK_ENV_SOCKET_ID_ANY, SPDK_MALLOC_DMA);
			sequence.buf = spdk_zmalloc(0x1000, 0x1000, NULL, SPDK_ENV_NUMA_ID_ANY, SPDK_MALLOC_DMA);
		}
		if (sequence.buf == NULL) {
			printf("ERROR: write buffer allocation failed\n");
+1 −1
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ pmr_persistence(void)
	/* Clear the done flag */
	g_config.pmr_dev.done = 0;

	buf = spdk_zmalloc(g_config.copy_size, 0x1000, NULL, SPDK_ENV_SOCKET_ID_ANY, SPDK_MALLOC_DMA);
	buf = spdk_zmalloc(g_config.copy_size, 0x1000, NULL, SPDK_ENV_NUMA_ID_ANY, SPDK_MALLOC_DMA);
	if (buf == NULL) {
		printf("ERROR: Buffer allocation failed\n");
		rc = -ENOMEM;
Loading