Skip to content

Create virtual numa node in case detection fails

Thomas Gruber requested to merge github/fork/Tobi29/rpi4 into master

Created by: Tobi29

This modifies the error handling to use a "virtual" NUMA node in case no proper one was found, in order to guarantee that there is always at least one, even on systems without any NUMA support (like on the Raspberry Pi 4).

Previously the hwloc backend already handled this on its own, so I extracted that code into a virtual "backend", which is used by both the proc and empty backends as well, in case no better info can be detected.

For memory usage the procfs is used, which was done by the hwloc backend as well, and for the numberOfProcessors the cpuid_topology.numHWThreads value is taken.

In order to avoid any behaviour changes the hwloc backend recomputes the numberOfProcessors on its own, not sure if that is a good or bad idea.

I have not gotten around to testing this on any machines with actual NUMA support, but the changes only cover previous error cases that should never occur with multiple NUMA nodes.

I added myself as an author in the two files I created, if it would be preferred without that, that would be fine as well. (The code is mostly pasted from existing parts anyways)

Comments on issues or better approaches to this would be very welcome :)

Fixes #290 (closed), showing sensible data there now (CPU type is still missing, but that should be unrelated):

--------------------------------------------------------------------------------
CPU name:       BCM2835
CPU type:       nil
CPU stepping:   3
********************************************************************************
Hardware Thread Topology
********************************************************************************
Sockets:                1
Cores per socket:       4
Threads per core:       1
--------------------------------------------------------------------------------
HWThread        Thread          Core            Socket          Available
0               0               0               0               *
1               0               1               0               *
2               0               2               0               *
3               0               3               0               *
--------------------------------------------------------------------------------
Socket 0:               ( 0 1 2 3 )
--------------------------------------------------------------------------------
********************************************************************************
Cache Topology
********************************************************************************
********************************************************************************
NUMA Topology
********************************************************************************
NUMA domains:           1
--------------------------------------------------------------------------------
Domain:                 0
Processors:             ( 0 1 2 3 )
Distances:              10
Free memory:            1570.78 MB
Total memory:           1865.91 MB
--------------------------------------------------------------------------------

Merge request reports

Loading