Commit 9f872d20 authored by Jim Harris's avatar Jim Harris Committed by Daniel Verkamp
Browse files

bdev_svc: do not unaffinitize thread if core mask specified



This keeps original behavior, allowing scheduler to move
the thread if no core mask was specified - something the
in-tree test scripts do now.  This original behavior made it
easier to just start bdev_svc as a dumb background process to
speed up nvme test programs running as secondary processes.

But if the user wants to specify a core mask to use bdev_svc
for other purposes, we shouldn't unaffinitize the thread.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I169a71d71c18ca7d6d1660e8401e84fc19a8cc9b

Reviewed-on: https://review.gerrithub.io/409774


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent de139e8c
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include "spdk/event.h"

static char g_path[256];
static bool g_unaffinitize_thread = false;

static void
bdev_svc_usage(void)
@@ -54,7 +55,9 @@ bdev_svc_start(void *arg1, void *arg2)
	int fd;
	int shm_id = (intptr_t)arg1;

	if (g_unaffinitize_thread) {
		spdk_unaffinitize_thread();
	}

	snprintf(g_path, sizeof(g_path), "/var/run/spdk_bdev%d", shm_id);
	fd = open(g_path, O_CREAT | O_EXCL | O_RDWR, S_IFREG);
@@ -91,6 +94,16 @@ main(int argc, char **argv)
		exit(rc);
	}

	/* User did not specify a reactor mask.  Test scripts may do this when using
	 *  bdev_svc as a primary process to speed up nvme test programs by running
	 *  them as secondary processes.  In that case, we will unaffinitize the thread
	 *  in the bdev_svc_start routine, which will allow the scheduler to move this
	 *  thread so it doesn't conflict with pinned threads in the secondary processes.
	 */
	if (opts.reactor_mask == NULL) {
		g_unaffinitize_thread = true;
	}

	rc = spdk_app_start(&opts, bdev_svc_start, (void *)(intptr_t)opts.shm_id, NULL);

	spdk_app_fini();