diff mbox series

[rt-tests,v4,08/16] rt-numa: Use mask size for iterator limit

Message ID 20210210133450.6991-9-dwagner@suse.de
State New
Headers show
Series rt-numa.h cleanups | expand

Commit Message

Daniel Wagner Feb. 10, 2021, 1:34 p.m. UTC
The bitmask structure knows its size use, thus use it as upper limit
in the loop.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/lib/rt-numa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c
index 7e99eab60681..b1bbb8c8052c 100644
--- a/src/lib/rt-numa.c
+++ b/src/lib/rt-numa.c
@@ -33,7 +33,7 @@  static int cpu_for_thread_sp(int thread_num, int max_cpus, struct bitmask *cpuma
 	m = thread_num % num_cpus;
 
 	/* there are num_cpus bits set, we want position of m'th one */
-	for (i = 0, cpu = 0; i < max_cpus; i++) {
+	for (i = 0, cpu = 0; i < cpumask->size; i++) {
 		if (numa_bitmask_isbitset(cpumask, i)) {
 			if (cpu == m)
 				return i;
@@ -97,7 +97,7 @@  static void use_current_cpuset(int max_cpus, struct bitmask *cpumask)
 	 * Clear bits that are not set in both the cpuset from the
 	 * environment, and in the user specified affinity.
 	 */
-	for (i = 0; i < max_cpus; i++) {
+	for (i = 0; i < cpumask->size; i++) {
 		if ((!numa_bitmask_isbitset(cpumask, i)) ||
 		    (!numa_bitmask_isbitset(curmask, i)))
 			numa_bitmask_clearbit(cpumask, i);