Commit b61cc189 authored by Yury Norov [NVIDIA]'s avatar Yury Norov [NVIDIA] Committed by Leon Romanovsky
Browse files

RDMI: hfi1: drop cpumask_empty() call in hfi1/affinity.c



In few places, the driver tests a cpumask for emptiness immediately
before calling functions that report emptiness themself.

Signed-off-by: default avatarYury Norov [NVIDIA] <yury.norov@gmail.com>
Link: https://patch.msgid.link/20250604193947.11834-8-yury.norov@gmail.com


Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent 3ad8fb8a
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -337,9 +337,10 @@ static int _dev_comp_vect_cpu_get(struct hfi1_devdata *dd,
		       &entry->def_intr.used);

	/* If there are non-interrupt CPUs available, use them first */
	if (!cpumask_empty(non_intr_cpus))
	cpu = cpumask_first(non_intr_cpus);
	else /* Otherwise, use interrupt CPUs */

	/* Otherwise, use interrupt CPUs */
	if (cpu >= nr_cpu_ids)
		cpu = cpumask_first(available_cpus);

	if (cpu >= nr_cpu_ids) { /* empty */
@@ -1080,8 +1081,7 @@ int hfi1_get_proc_affinity(int node)
		 * loop as the used mask gets reset when
		 * (set->mask == set->used) before this loop.
		 */
		cpumask_andnot(diff, hw_thread_mask, &set->used);
		if (!cpumask_empty(diff))
		if (cpumask_andnot(diff, hw_thread_mask, &set->used))
			break;
	}
	hfi1_cdbg(PROC, "Same available HW thread on all physical CPUs: %*pbl",
@@ -1113,8 +1113,7 @@ int hfi1_get_proc_affinity(int node)
	 *    used for process assignments using the same method as
	 *    the preferred NUMA node.
	 */
	cpumask_andnot(diff, available_mask, intrs_mask);
	if (!cpumask_empty(diff))
	if (cpumask_andnot(diff, available_mask, intrs_mask))
		cpumask_copy(available_mask, diff);

	/* If we don't have CPUs on the preferred node, use other NUMA nodes */
@@ -1130,8 +1129,7 @@ int hfi1_get_proc_affinity(int node)
		 * At first, we don't want to place processes on the same
		 * CPUs as interrupt handlers.
		 */
		cpumask_andnot(diff, available_mask, intrs_mask);
		if (!cpumask_empty(diff))
		if (cpumask_andnot(diff, available_mask, intrs_mask))
			cpumask_copy(available_mask, diff);
	}
	hfi1_cdbg(PROC, "Possible CPUs for process: %*pbl",