Skip to content

[fix](cli): handle edge cases with empty NUMA nodes#1929

Merged
yyj6666667 merged 1 commit intokvcache-ai:mainfrom
Andy18650:fix/empty-numa-detection
Apr 13, 2026
Merged

[fix](cli): handle edge cases with empty NUMA nodes#1929
yyj6666667 merged 1 commit intokvcache-ai:mainfrom
Andy18650:fix/empty-numa-detection

Conversation

@Andy18650
Copy link
Copy Markdown
Contributor

What does this PR do?

When the system contains a NUMA node without any cores, the _parse_cpu_list() function crashes with the following error:

ValueError: invalid literal for int() with base 10: ''

This fix adds edge-case handling by returning an empty list. Further processing downstream will treat the return value as one single NUMA node, which is expected behavior.

Technical background

Empty NUMA nodes appear on systems with Intel's Optane DCPMM modules. In standard Memory Mode, some system DRAM is used as a transparent direct-mapped cache for Optane modules, and thus will be considered one NUMA node per socket. In this case, the DRAM capacity is "absorbed" into that of Optane (for example, 64GiB DRAM+256GiB Optane = 256GiB visible to system, minus some overhead). However, there is also a technique to expand system RAM with Optane Modules by setting them to App Direct mode and them mapping them as memory on a virtual NUMA node with daxctl. This enables the capacity of DRAM and Optane to be presented as separate memory regions. Furthermore, this enables advanced LRU-based page promotion and demotion algorithm to be used.

Before submitting

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the _parse_cpu_list utility function to handle empty input strings, which occurs when a NUMA node has no assigned CPU cores. The reviewer suggested using a more idiomatic Python check for the empty string and improving the grammar of the accompanying comment.

Comment on lines +449 to +451
if cpulist == "":
# if there are no cpu cores for a specific numa node (for example, virtual numa on optane), return empty list
return cpus
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using if not cpulist: is more idiomatic in Python for checking empty strings and also handles None values gracefully. Additionally, the comment should be capitalized and punctuated correctly for better readability.

Suggested change
if cpulist == "":
# if there are no cpu cores for a specific numa node (for example, virtual numa on optane), return empty list
return cpus
if not cpulist:
# If there are no CPU cores for a specific NUMA node (e.g., virtual NUMA on Optane), return an empty list.
return []

@yyj6666667
Copy link
Copy Markdown
Collaborator

Good catch on the edge case, with one line to save them all. Many thanks.

@yyj6666667 yyj6666667 merged commit f42e94a into kvcache-ai:main Apr 13, 2026
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