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: Jim Harris <james.r.harris@intel.com> Change-Id: I169a71d71c18ca7d6d1660e8401e84fc19a8cc9b Reviewed-on: https://review.gerrithub.io/409774 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
de139e8c8b
commit
9f872d2040
@ -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;
|
||||
|
||||
spdk_unaffinitize_thread();
|
||||
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();
|
||||
|
Loading…
Reference in New Issue
Block a user