[fix](cli): handle edge cases with empty NUMA nodes#1929
Merged
yyj6666667 merged 1 commit intokvcache-ai:mainfrom Apr 13, 2026
Merged
[fix](cli): handle edge cases with empty NUMA nodes#1929yyj6666667 merged 1 commit intokvcache-ai:mainfrom
yyj6666667 merged 1 commit intokvcache-ai:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
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 |
Contributor
There was a problem hiding this comment.
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 [] |
Collaborator
|
Good catch on the edge case, with one line to save them all. Many thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: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