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

thread: add NUMA node support to spdk_iobuf_put()



For the default numa-disabled case, just always free the buffer to
node 0. Otherwise use spdk_mem_get_numa_id() to find the numa_id
based on the buffer pointer.

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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Community-CI: Community CI Samsung <spdk.community.ci.samsung@gmail.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
parent 40c9acf6
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -751,9 +751,16 @@ spdk_iobuf_put(struct spdk_iobuf_channel *ch, void *buf, uint64_t len)
	struct spdk_iobuf_buffer *iobuf_buf;
	struct spdk_iobuf_node_cache *cache;
	struct spdk_iobuf_pool_cache *pool;
	uint32_t numa_id;
	size_t sz;

	cache = &ch->cache[0];
	if (g_iobuf.opts.enable_numa) {
		numa_id = spdk_mem_get_numa_id(buf, NULL);
	} else {
		numa_id = 0;
	}

	cache = &ch->cache[numa_id];

	assert(spdk_io_channel_get_thread(ch->parent) == spdk_get_thread());
	if (len <= cache->small.bufsize) {
+4 −0
Original line number Diff line number Diff line
@@ -273,6 +273,10 @@ spdk_vtophys(const void *buf, uint64_t *size)
}
#endif

#ifndef UNIT_TEST_NO_ENV_MEMORY
DEFINE_STUB(spdk_mem_get_numa_id, int32_t, (const void *buf, uint64_t *size), 0);
#endif

void
spdk_memzone_dump(FILE *f)
{
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
#include "env_dpdk/memory.c"

#define UNIT_TEST_NO_VTOPHYS
#define UNIT_TEST_NO_ENV_MEMORY
#include "common/lib/test_env.c"
#include "spdk_internal/cunit.h"