Skip to content

fix numa node count on linux: return the count, not the highest node … - #1365

Merged
Daan (daanx) merged 1 commit into
microsoft:devfrom
devnexen:numa_fix
Aug 14, 2026
Merged

fix numa node count on linux: return the count, not the highest node …#1365
Daan (daanx) merged 1 commit into
microsoft:devfrom
devnexen:numa_fix

Conversation

@devnexen

Copy link
Copy Markdown
Contributor

…index

The scan starts at node1, so on a machine with nodes 0..N-1 last_found ends at N-1 and is returned as the count: 2 nodes reported as 1, 4 as 3. Callers use it as a bound on node ids (numa_node % numa_count), so the highest node gets folded onto node 0.

Return last_found + 1, as the Windows primitive does with GetNumaHighestNodeNumber() + 1.

Follow-up to 870ac85.

…index

The scan starts at node1, so on a machine with nodes 0..N-1 `last_found`
ends at N-1 and is returned as the count: 2 nodes reported as 1, 4 as 3.
Callers use it as a bound on node ids (`numa_node % numa_count`), so the
highest node gets folded onto node 0.

Return `last_found + 1`, as the Windows primitive does with
`GetNumaHighestNodeNumber() + 1`.

Follow-up to 870ac85.
@daanx
Daan (daanx) merged commit d31778f into microsoft:dev Aug 14, 2026
1 check passed
@daanx

Copy link
Copy Markdown
Collaborator

Thank you David :-)
Not sure how well we do on actual systems with sparse nodes; I wonder if we can map them to sequential numbers but maybe that is a bit too much complication for a rare situation.

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.

2 participants