[kvm-unit-tests PATCH] Changed cpumask_next to wrap instead of terminating after nr_cpus.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changed cpumask_next() to wrap instead of terminating after nr_cpus.

Signed-off-by: Cade Richard <cade.richard@xxxxxxxxxxxx>
---
 lib/cpumask.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/cpumask.h b/lib/cpumask.h
index be191923..5105c3bd 100644
--- a/lib/cpumask.h
+++ b/lib/cpumask.h
@@ -109,8 +109,10 @@ static inline void cpumask_copy(cpumask_t *dst, const cpumask_t *src)
 
 static inline int cpumask_next(int cpu, const cpumask_t *mask)
 {
-	while (++cpu < nr_cpus && !cpumask_test_cpu(cpu, mask))
-		;
+	do {
+		if (++cpu > nr_cpus)
+			cpu = 0;
+	} while (!cpumask_test_cpu(cpu, mask));
 	return cpu;
 }
 
-- 
2.43.0





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux