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 <shuhei.matsumoto.xt@hitachi.com> Change-Id: Ibb01d2c77d6d82d7cc81df722e7848b357d4e9e7 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/840 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
a5bcbbefcb
commit
c688f5e93e
@ -45,9 +45,6 @@
|
|||||||
|
|
||||||
static TAILQ_HEAD(, vhost_poll_group) g_poll_groups = TAILQ_HEAD_INITIALIZER(g_poll_groups);
|
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. */
|
/* Path to folder where character device will be created. Can be set by user. */
|
||||||
static char dev_dirname[PATH_MAX] = "";
|
static char dev_dirname[PATH_MAX] = "";
|
||||||
|
|
||||||
@ -715,6 +712,7 @@ spdk_vhost_dev_get_cpumask(struct spdk_vhost_dev *vdev)
|
|||||||
struct vhost_poll_group *
|
struct vhost_poll_group *
|
||||||
vhost_get_poll_group(struct spdk_cpuset *cpumask)
|
vhost_get_poll_group(struct spdk_cpuset *cpumask)
|
||||||
{
|
{
|
||||||
|
struct spdk_cpuset tmp_cpuset = {};
|
||||||
struct vhost_poll_group *pg, *selected_pg;
|
struct vhost_poll_group *pg, *selected_pg;
|
||||||
uint32_t min_ctrlrs;
|
uint32_t min_ctrlrs;
|
||||||
|
|
||||||
@ -722,11 +720,11 @@ vhost_get_poll_group(struct spdk_cpuset *cpumask)
|
|||||||
selected_pg = TAILQ_FIRST(&g_poll_groups);
|
selected_pg = TAILQ_FIRST(&g_poll_groups);
|
||||||
|
|
||||||
TAILQ_FOREACH(pg, &g_poll_groups, tailq) {
|
TAILQ_FOREACH(pg, &g_poll_groups, tailq) {
|
||||||
spdk_cpuset_copy(&g_tmp_cpuset, cpumask);
|
spdk_cpuset_copy(&tmp_cpuset, cpumask);
|
||||||
spdk_cpuset_and(&g_tmp_cpuset, spdk_thread_get_cpumask(pg->thread));
|
spdk_cpuset_and(&tmp_cpuset, spdk_thread_get_cpumask(pg->thread));
|
||||||
|
|
||||||
/* ignore threads which could be relocated to a non-masked cpu. */
|
/* 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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user