fio_plugin: Reset the cpu core affinity after spdk_env_init
The reaon is that rte_eal_init called in spdk_env_init binds the master thread on master core, we need to restore the affinity. Change-Id: I4eb2d36b74404c1af6d242c4fd5c403bd3d5036c Signed-off-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
parent
013471a121
commit
177ab97b6e
@ -179,6 +179,23 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
|
||||
fio_ctrlr->ns_list = fio_ns;
|
||||
}
|
||||
|
||||
static void
|
||||
cpu_core_unaffinitized(void)
|
||||
{
|
||||
cpu_set_t mask;
|
||||
int i;
|
||||
int num = sysconf(_SC_NPROCESSORS_CONF);
|
||||
|
||||
CPU_ZERO(&mask);
|
||||
for (i = 0; i < num; i++) {
|
||||
CPU_SET(i, &mask);
|
||||
}
|
||||
|
||||
if (pthread_setaffinity_np(pthread_self(), sizeof(mask), &mask) < 0) {
|
||||
SPDK_ERRLOG("set thread affinity failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* Called once at initialization. This is responsible for gathering the size of
|
||||
* each "file", which in our case are in the form
|
||||
* 'key=value [key=value] ... ns=value'
|
||||
@ -216,6 +233,7 @@ static int spdk_fio_setup(struct thread_data *td)
|
||||
opts.dpdk_mem_size = 512;
|
||||
spdk_env_init(&opts);
|
||||
spdk_env_initialized = true;
|
||||
cpu_core_unaffinitized();
|
||||
}
|
||||
|
||||
for_each_file(td, f, i) {
|
||||
|
Loading…
Reference in New Issue
Block a user