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

fio/bdev: 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 bdevs, and those
bdevs don't share the same numa_id, we will just revert to
SPDK_ENV_NUMA_ID_ANY.

Also, if any of the bdevs 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: I92caf0dadc15af3196ae9e0f5ae410ad4cee28f3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/24155


Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 65fb818a
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -833,7 +833,26 @@ 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, 0x1000, NULL);
	struct spdk_fio_thread	*fio_thread = td->io_ops_data;
	struct spdk_fio_target	*fio_target;
	int32_t numa_id = SPDK_ENV_NUMA_ID_ANY, tmp_numa_id;

	/* If all bdevs used by this fio_thread have the same numa socket
	 * id, allocate from that socket. If they come from different numa
	 * sockets, then don't try to optimize and just use NUMA_ID_ANY.
	 */
	TAILQ_FOREACH(fio_target, &fio_thread->targets, link) {
		tmp_numa_id = spdk_bdev_get_numa_id(fio_target->bdev);
		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, 0x1000, NULL, numa_id);
	return td->orig_buffer == NULL;
}