-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: node_list with memory-less nodes #33
Conversation
7023279
to
81d115c
Compare
numademo.c
Outdated
|
||
numnodes = numa_num_configured_nodes(); | ||
node_to_use = (int *)malloc(numnodes * sizeof(int)); | ||
max_node = numa_max_node(); | ||
for (a = 0; a <= max_node; a++) { | ||
if(numa_node_size(a, &free_node_sizes) != -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this instead?
if (numa_node_size(a, &free_node_sizes) > 0)
(Nitpick: we usually do a space between if
(or for
, while
, etc.) and the initial (
, also to differentiate them from function calls.)
test/distance.c
Outdated
@@ -17,7 +17,7 @@ int main(void) | |||
node_to_use = (int *)malloc(numnodes * sizeof(int)); | |||
for (a = 0; a <= maxnode; a++) { | |||
size = numa_node_size(a, &free_node_sizes); | |||
if(size != -1) | |||
if((size != -1) && (size != 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
Also suggestion to use "memory-less" (or perhaps "memoryless") instead of "memory less" in the commit description. "memory less" looks like the "less" is referring to "nodes" at a glance... |
@filbranden Sure, make sense. Thanks for the comments. |
81d115c
to
9974ec6
Compare
@filbranden There is another issue with |
9974ec6
to
036b6d9
Compare
Patch adds check to avoid memory-less nodes while traversing till max node, and this also prevents nodes_to_use sysmalloc failure as nodes_to_use is malloc'ed with numa_num_configured_nodes which returns the number of nodes configured with memory. Signed-off-by: Harish <harish@linux.vnet.ibm.com>
036b6d9
to
e033221
Compare
Looks great, thanks! |
Patch adds check to avoid memory-less nodes while traversing till max node, and this also prevents nodes_to_use sysmalloc failure as nodes_to_use is malloc'ed with numa_num_configured_nodes which
returns the number of nodes configured with memory.
Signed-off-by: Harish harish@linux.vnet.ibm.com