Fix for machines without numa
cover Fix for machines without numa
Trying to return the code to a state where numa is required at compile time but not at runtime
- The first patch should allow cyclictest to run on a machine without numa.
- The second patch is a clean-up of some old code
The code is pushed in git to branch unstable/devel/no-numa-runtime so that people can test before I integrate the code back in the main branch
Thanks
John
John Kacur (2):
rt-tests: Don't assume numa is available at runtime
rt-tests: remove rt_numa_bitmask_count in rt_numa.h
src/cyclictest/cyclictest.c | 8 ++------ src/cyclictest/rt_numa.h | 12 ------------ src/lib/rt-numa.c | 17 +++++++++++------ src/signaltest/signaltest.c | 8 ++------ 4 files changed, 15 insertions(+), 30 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/2 rt-tests: Don't assume numa is available at runtime
- Rework numa_initialize a bit to return the status of numa
- Don't fail if numa is not available after the call to numa_initialize
--- src/cyclictest/cyclictest.c | 8 ++------ src/lib/rt-numa.c | 17 +++++++++++------ src/signaltest/signaltest.c | 8 ++------ 3 files changed, 15 insertions(+), 18 deletions(-)
src/cyclictest/cyclictest.c +2 -6
@@ -1018,9 +1018,7 @@ static void process_options(int argc, char *argv[], int max_cpus)/* smp sets AFFINITY_USEALL in OPT_SMP */ if (smp)break ; -if (numa_initialize ()) -fatal ("Couldn't initialize libnuma" ); - numa =1 ; + numa =numa_initialize ();if (optarg) {parse_cpumask (optarg, max_cpus, &affinity_mask); setaffinity =AFFINITY_SPECIFIED ;
@@ -1204,9 +1202,7 @@ static void process_options(int argc, char *argv[], int max_cpus)/* if smp wasn't requested, test for numa automatically */ if (!smp) { -if (numa_initialize ()) -fatal ("Couldn't initialize libnuma" ); - numa =1 ; + numa =numa_initialize ();if (setaffinity ==AFFINITY_UNSPECIFIED ) setaffinity =AFFINITY_USEALL ; }
src/lib/rt-numa.c +11 -6
@@ -13,19 +13,24 @@#include "rt-error.h" #include "rt-numa.h" -/* numa_available() must be called before any other calls to the numa library */ +/* +* numa_available() must be called before any other calls to the numa library +* returns 0 if numa is available, or 1 if numa is not available +*/ int numa_initialize (void ) { -static int is_initialized; +static int is_initialized;// Only call numa_available once +static int numa;if (is_initialized ==1 ) -return 0 ; +return numa; -if (numa_available () ==-1 ) -return -1 ; +if (numa_available () !=-1 ) + numa =1 ; is_initialized =1 ; -return 0 ; + +return numa; }int get_available_cpus (struct bitmask *cpumask)
src/signaltest/signaltest.c +2 -6
@@ -253,9 +253,7 @@ 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 ; + numa =numa_initialize ();if (optarg) {parse_cpumask (optarg, max_cpus, &affinity_mask); setaffinity =AFFINITY_SPECIFIED ;
@@ -339,9 +337,7 @@ 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 ; + numa =numa_initialize ();if (setaffinity ==AFFINITY_UNSPECIFIED ) setaffinity =AFFINITY_USEALL ; }
Signature · 1 line
2.26.2
PATCH 2/2 rt-tests: remove rt_numa_bitmask_count in rt_numa.h
In reply to John KacurRemove rt_numa_bitmask_count as it is unused. The code uses numa_bitmask_weight() from numa instead
--- src/cyclictest/rt_numa.h | 12 ------------ 1 file changed, 12 deletions(-)
src/cyclictest/rt_numa.h +0 -12
@@ -83,16 +83,4 @@ static inline void rt_bitmask_free(struct bitmask *mask) numa_bitmask_free(mask); } -/** Returns number of bits set in mask. */ -static inline unsigned int rt_numa_bitmask_count (const struct bitmask *mask) -{ -unsigned int num_bits =0 , i; -for (i =0 ; i < mask->size; i++) { -if (rt_numa_bitmask_isbitset (mask, i)) - num_bits++; - } -/* Could stash this instead of recomputing every time. */ -return num_bits; -} -#endif /* _RT_NUMA_H */
Signature · 1 line
2.26.2
Hi John,
Quoted 11 lines · John Kacur
Trying to return the code to a state where numa is required at compile time but not at runtime
- The first patch should allow cyclictest to run on a machine without numa.
- The second patch is a clean-up of some old code
The code is pushed in git to branch unstable/devel/no-numa-runtime so that people can test before I integrate the code back in the main branch
arm32 seems to work fine.
Thanks,
Kurt
Quoted 15 lines · Kurt Kanzenbach
Hi John,
Quoted 11 lines · John Kacur
Trying to return the code to a state where numa is required at compile time but not at runtime
- The first patch should allow cyclictest to run on a machine without numa.
- The second patch is a clean-up of some old code
The code is pushed in git to branch unstable/devel/no-numa-runtime so that people can test before I integrate the code back in the main branch
Quoted 7 lines
arm32 seems to work fine.
Thanks,
Kurt
Thanks, I added your tested by and merged all the changes into unstable/devel/latest
John