diff mbox series

[2/4] rt-tests: cyclictest: Remove support for compiling without NUMA

Message ID 20200304215548.13079-2-jkacur@redhat.com
State New
Headers show
Series None | expand

Commit Message

John Kacur March 4, 2020, 9:55 p.m. UTC
We announced way back in 2015 that compiling without the NUMA libs was
no-longer supported, but we left the bits in there for you to do it
anyway.

Since this is not supported, and is broken now anyway, let's remove the
cruft.

Of course running on non-NUMA machines should still work fine.

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 Makefile                 | 17 +++-------
 src/cyclictest/rt_numa.h | 67 ----------------------------------------
 2 files changed, 4 insertions(+), 80 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 186eccb1c882..1475007d7bb4 100644
--- a/Makefile
+++ b/Makefile
@@ -76,19 +76,10 @@  ostype := $(lastword $(subst -, ,$(dumpmachine)))
 machinetype := $(shell echo $(dumpmachine)| \
     sed -e 's/-.*//' -e 's/i.86/i386/' -e 's/mips.*/mips/' -e 's/ppc.*/powerpc/')
 
-# The default is to assume you have libnuma installed, which is fine to do
-# even on non-numa machines. If you don't want to install the numa libs, for
-# example, they might not be available in an embedded environment, then
-# compile with
-# make NUMA=0
-ifneq ($(filter x86_64 i386 ia64 mips powerpc,$(machinetype)),)
-NUMA 	:= 1
-endif
-
-ifeq ($(NUMA),1)
-	CFLAGS += -DNUMA
-	NUMA_LIBS = -lnuma
-endif
+# You have to have libnuma installed, which is fine to do even if you are
+# running on non-numa machines
+CFLAGS += -DNUMA
+NUMA_LIBS = -lnuma
 
 include src/arch/android/Makefile
 
diff --git a/src/cyclictest/rt_numa.h b/src/cyclictest/rt_numa.h
index 466f0b68f801..46690941e0a6 100644
--- a/src/cyclictest/rt_numa.h
+++ b/src/cyclictest/rt_numa.h
@@ -1,8 +1,6 @@ 
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * A numa library for cyclictest.
- * The functions here are designed to work whether cyclictest has been
- * compiled with numa support or not.
  *
  * (C) 2010 John Kacur <jkacur@redhat.com>
  * (C) 2010 Clark Williams <williams@redhat.com>
@@ -17,7 +15,6 @@ 
 
 static int numa = 0;
 
-#ifdef NUMA
 #include <numa.h>
 
 static void *
@@ -86,70 +83,6 @@  static inline void rt_bitmask_free(struct bitmask *mask)
 	numa_bitmask_free(mask);
 }
 
-
-#else /* ! NUMA */
-
-struct bitmask {
-    unsigned long size; /* number of bits in the map */
-    unsigned long *maskp;
-};
-#define BITS_PER_LONG    (8*sizeof(long))
-
-static inline void *threadalloc(size_t size, int n) { return malloc(size); }
-static inline void threadfree(void *ptr, size_t s, int n) { free(ptr); }
-static inline void rt_numa_set_numa_run_on_node(int n, int c) { }
-static inline int rt_numa_numa_node_of_cpu(int cpu) { return -1; }
-static void *rt_numa_numa_alloc_onnode(size_t s, int n, int c) { return NULL; }
-
-/*
- * Map legacy CPU affinity behavior onto bit mask infrastructure
- */
-static inline unsigned int rt_numa_bitmask_isbitset( const struct bitmask *mask,
-	unsigned long i)
-{
-	long bit = mask->maskp[i/BITS_PER_LONG] & (1<<(i % BITS_PER_LONG));
-	return (bit != 0);
-}
-
-static inline struct bitmask* rt_numa_parse_cpustring(const char* s,
-	int max_cpus)
-{
-	int cpu;
-	struct bitmask *mask = NULL;
-	cpu = atoi(s);
-	if (0 <= cpu && cpu < max_cpus) {
-		mask = malloc(sizeof(*mask));
-		if (mask) {
-			/* Round up to integral number of longs to contain
-			 * max_cpus bits */
-			int nlongs = (max_cpus+BITS_PER_LONG-1)/BITS_PER_LONG;
-
-			mask->maskp = calloc(nlongs, sizeof(unsigned long));
-			if (mask->maskp) {
-				mask->maskp[cpu/BITS_PER_LONG] |=
-					(1UL << (cpu % BITS_PER_LONG));
-				mask->size = max_cpus;
-			} else {
-				free(mask);
-				mask = NULL;
-			}
-		}
-	}
-	return mask;
-}
-
-static inline void rt_bitmask_free(struct bitmask *mask)
-{
-	free(mask->maskp);
-	free(mask);
-}
-
-#endif	/* NUMA */
-
-/*
- * Any behavioral differences above are transparent to these functions
- */
-
 /** Returns number of bits set in mask. */
 static inline unsigned int rt_numa_bitmask_count(const struct bitmask *mask)
 {