Commit 4ee52458 authored by Vitaly Kuznetsov's avatar Vitaly Kuznetsov Committed by Wei Liu
Browse files

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: default avatarMichael Kelley <mikelley@microsoft.com>
Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: default avatarMichael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/20220128103412.3033736-3-vkuznets@redhat.com


Signed-off-by: default avatarWei Liu <wei.liu@kernel.org>
parent de96e8a0
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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.