As documented, the NUMA auto-detection is not supposed to be used when
the CPU affinity was set either by taskset (already checked) or by a
cpu-map directive. However this check was missing, so that configs
having cpu-map entries would still first bind to a single node. In
practice it has no impact on correct configs since bindings will be
replaced. However for those where the cpu-map directive are not
exhaustive it will have the impact of binding those threads to one node,
which disagrees with the doc (and makes future evolutions significantly
more complicated).
This could be backported to 2.4 where numa-cpu-mapping was added, though
if nobody encountered this by then maybe we should only focus on recent
versions that are more NUMA-friendly (e.g. 2.8 only). This patch depends
on this previous commit that brings the function we rely on:
MINOR: cpuset: add cpu_map_configured() to know if a cpu-map was found
{
int numa_cores = 0;
#if defined(USE_CPU_AFFINITY)
- if (global.numa_cpu_mapping && !thread_cpu_mask_forced())
+ if (global.numa_cpu_mapping && !thread_cpu_mask_forced() && !cpu_map_configured())
numa_cores = numa_detect_topology();
#endif
global.nbthread = numa_cores ? numa_cores :