Thread (44 messages) 44 messages, 6 authors, 2021-02-19

[rt-tests v2 v2 07/20] signaltest: Always use libnuma

From: Daniel Wagner <hidden>
Date: 2020-12-18 16:20:14
Subsystem: the rest · Maintainer: Linus Torvalds

libnuma is hard dependency for signaltest. Thus we can always call
numa_initialize(). This allows us to remove the global 'numa' variable
to track if libnuma has been initialized or not.

Signed-off-by: Daniel Wagner <redacted>
---
 src/signaltest/signaltest.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index 918d2ab98f6e..b3a82f8c4f65 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -206,7 +206,6 @@ static int quiet;
 static int lockall;
 static struct bitmask *affinity_mask = NULL;
 static int smp = 0;
-static int numa = 0;
 static int setaffinity = AFFINITY_UNSPECIFIED;
 
 /* Process commandline options */
@@ -214,6 +213,7 @@ static void process_options(int argc, char *argv[], unsigned int max_cpus)
 {
 	int option_affinity = 0;
 	int error = 0;
+	int numa = 0;
 
 	for (;;) {
 		int option_index = 0;
@@ -242,8 +242,6 @@ static void process_options(int argc, char *argv[], unsigned int max_cpus)
 			/* smp sets AFFINITY_USEALL in OPT_SMP */
 			if (smp)
 				break;
-			if (numa_initialize())
-				fatal("Couldn't initialize libnuma");
 			numa = 1;
 			if (optarg) {
 				parse_cpumask(optarg, max_cpus, &affinity_mask);
@@ -298,9 +296,6 @@ static void process_options(int argc, char *argv[], unsigned int max_cpus)
 
 	/* if smp wasn't requested, test for numa automatically */
 	if (!smp) {
-		if (numa_initialize())
-			fatal("Couldn't initialize libnuma");
-		numa = 1;
 		if (setaffinity == AFFINITY_UNSPECIFIED)
 			setaffinity = AFFINITY_USEALL;
 	}
@@ -354,6 +349,9 @@ int main(int argc, char **argv)
 	int status, cpu;
 	int max_cpus = sysconf(_SC_NPROCESSORS_ONLN);
 
+	if (numa_initialize())
+		fatal("Couldn't initialize libnuma");
+
 	process_options(argc, argv, max_cpus);
 
 	if (check_privs())
-- 
2.29.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help