Commit a8048042 authored by Jim Harris's avatar Jim Harris
Browse files

fio/nvme: use numa_id when allocating io buffers



fio does the io buffer allocations on a per-thread basis, so if
a thread/job is associated with multiple controllers, and those
controllers don't share the same numa_id, we will just revert to
SPDK_ENV_NUMA_ID_ANY.

Also, if any of the ctrlrs report SPDK_ENV_NUMA_ID_ANY, revert
to SPDK_ENV_NUMA_ID_ANY for that case too.

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


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <ben@nvidia.com>
parent f062f928
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -787,7 +787,28 @@ spdk_fio_close(struct thread_data *td, struct fio_file *f)
static int
spdk_fio_iomem_alloc(struct thread_data *td, size_t total_mem)
{
	td->orig_buffer = spdk_dma_zmalloc(total_mem, NVME_IO_ALIGN, NULL);
	struct spdk_fio_thread	*fio_thread = td->io_ops_data;
	struct spdk_fio_qpair	*fio_qpair;
	struct spdk_nvme_ctrlr	*ctrlr;
	int32_t numa_id = SPDK_ENV_NUMA_ID_ANY, tmp_numa_id;

	/* If all ctrlrs used by this fio_thread have the same numa
	 * id, allocate from that one. If they come from different numa
	 * ids, then don't try to optimize and just use SPDK_ENV_NUMA_ID_ANY.
	 */
	TAILQ_FOREACH(fio_qpair, &fio_thread->fio_qpair, link) {
		ctrlr = fio_qpair->fio_ctrlr->ctrlr;
		tmp_numa_id = spdk_nvme_ctrlr_get_numa_id(ctrlr);
		if (numa_id == SPDK_ENV_NUMA_ID_ANY) {
			numa_id = tmp_numa_id;
		} else if (tmp_numa_id != numa_id ||
			   tmp_numa_id == SPDK_ENV_NUMA_ID_ANY) {
			numa_id = SPDK_ENV_NUMA_ID_ANY;
			break;
		}
	}

	td->orig_buffer = spdk_dma_zmalloc_socket(total_mem, NVME_IO_ALIGN, NULL, numa_id);
	return td->orig_buffer == NULL;
}