summaryrefslogtreecommitdiff
path: root/drivers/hv
diff options
context:
space:
mode:
authorVitaly Kuznetsov <vkuznets@redhat.com>2022-01-28 11:34:12 +0100
committerWei Liu <wei.liu@kernel.org>2022-02-03 12:47:31 +0000
commit4ee524587105011ef43e5bd3ef5ed019715363dd (patch)
tree77d6691f05bd9cb5e19ef4b2bcf01ff9d9738f7b /drivers/hv
parentde96e8a09889b35dd8d1cb6d19ef2bb123b05be1 (diff)
Drivers: hv: Compare cpumasks and not their weights in init_vp_index()
The condition is supposed to check whether 'allocated_mask' got fully exhausted, i.e. there's no free CPU on the NUMA node left so we have to use one of the already used CPUs. As only bits which correspond to CPUs from 'cpumask_of_node(numa_node)' get set in 'allocated_mask', checking for the equal weights is technically correct but not obvious. Let's compare cpumasks directly. No functional change intended. Suggested-by: Michael Kelley <mikelley@microsoft.com> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Reviewed-by: Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/20220128103412.3033736-3-vkuznets@redhat.com Signed-off-by: Wei Liu <wei.liu@kernel.org>
Diffstat (limited to 'drivers/hv')
-rw-r--r--drivers/hv/channel_mgmt.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 52cf6ae525e9..26d269ba947c 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -762,8 +762,7 @@ static void init_vp_index(struct vmbus_channel *channel)
}
allocated_mask = &hv_context.hv_numa_map[numa_node];
- if (cpumask_weight(allocated_mask) ==
- cpumask_weight(cpumask_of_node(numa_node))) {
+ if (cpumask_equal(allocated_mask, cpumask_of_node(numa_node))) {
/*
* We have cycled through all the CPUs in the node;
* reset the allocated map.