Commit c688f5e9 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ibb01d2c77d6d82d7cc81df722e7848b357d4e9e7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/840


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent a5bcbbef
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -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;
		}