From c688f5e93e10faa3313407f7bb891bd6e9b5df05 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Wed, 12 Feb 2020 20:14:34 -0500 Subject: [PATCH] lib/vhost: Replace global cpuset by local one in vhost_get_poll_group() Replace g_tmp_cpuset by tmp_cpuset local in vhost_get_poll_group() without any side effect. Signed-off-by: Shuhei Matsumoto Change-Id: Ibb01d2c77d6d82d7cc81df722e7848b357d4e9e7 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/840 Tested-by: SPDK CI Jenkins Reviewed-by: Darek Stojaczyk Reviewed-by: Changpeng Liu --- lib/vhost/vhost.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index 89f6c4504..489fc9161 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -45,9 +45,6 @@ static TAILQ_HEAD(, vhost_poll_group) g_poll_groups = TAILQ_HEAD_INITIALIZER(g_poll_groups); -/* Temporary cpuset for poll group assignment */ -static struct spdk_cpuset g_tmp_cpuset; - /* Path to folder where character device will be created. Can be set by user. */ static char dev_dirname[PATH_MAX] = ""; @@ -715,6 +712,7 @@ spdk_vhost_dev_get_cpumask(struct spdk_vhost_dev *vdev) struct vhost_poll_group * vhost_get_poll_group(struct spdk_cpuset *cpumask) { + struct spdk_cpuset tmp_cpuset = {}; struct vhost_poll_group *pg, *selected_pg; uint32_t min_ctrlrs; @@ -722,11 +720,11 @@ vhost_get_poll_group(struct spdk_cpuset *cpumask) selected_pg = TAILQ_FIRST(&g_poll_groups); TAILQ_FOREACH(pg, &g_poll_groups, tailq) { - spdk_cpuset_copy(&g_tmp_cpuset, cpumask); - spdk_cpuset_and(&g_tmp_cpuset, spdk_thread_get_cpumask(pg->thread)); + spdk_cpuset_copy(&tmp_cpuset, cpumask); + spdk_cpuset_and(&tmp_cpuset, spdk_thread_get_cpumask(pg->thread)); /* ignore threads which could be relocated to a non-masked cpu. */ - if (!spdk_cpuset_equal(&g_tmp_cpuset, spdk_thread_get_cpumask(pg->thread))) { + if (!spdk_cpuset_equal(&tmp_cpuset, spdk_thread_get_cpumask(pg->thread))) { continue; }