Skip to content

Comments

Harden NUMA affinity node validation and sparse CPU mapping#7

Open
yunuservices wants to merge 1 commit intoTuinity:masterfrom
yunuservices:fix/numa-nullsafe-coremap
Open

Harden NUMA affinity node validation and sparse CPU mapping#7
yunuservices wants to merge 1 commit intoTuinity:masterfrom
yunuservices:fix/numa-nullsafe-coremap

Conversation

@yunuservices
Copy link

This PR fixes two NUMA-related correctness issues:

  • Prevents null-driven failures when setting NUMA affinity with invalid node ids.
  • Fixes sparse CPU-to-NUMA mapping behavior so unknown/unmapped cores are not implicitly treated as node 0.

Problem

  • OSNuma#setCurrentNumaAffinity(int[]) could fail with a null path when getCores(node) returned null.
  • LinuxNuma core mapping initialization could leave gaps that defaulted to 0, causing incorrect NUMA locality assumptions on some topologies.

Changes

  • OSNuma.java
    • Added validation in setCurrentNumaAffinity(int[]).
    • Throws IllegalArgumentException for unknown NUMA nodes instead of allowing a null path.
    • Hardened PreCalculatedNuma handling for unknown mappings.
  • LinuxNuma.java
    • Reworked static initialization flow for safer instance construction.
    • Initializes coreToNuma deterministically and treats unknown entries explicitly.
    • Keeps mapping consistent for sparse/non-contiguous CPU ids.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant