Skip to content
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

Merged
merged 1 commit into from
Jun 21, 2018

Conversation

harish-24
Copy link
Contributor

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

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)
Copy link
Member

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))
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

@filbranden
Copy link
Member

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...

@harish-24
Copy link
Contributor Author

@filbranden Sure, make sense. Thanks for the comments.

@harish-24 harish-24 changed the title Fix: node_list with memory less nodes Fix: node_list with memory-less nodes Jun 21, 2018
@harish-24
Copy link
Contributor Author

@filbranden There is another issue with test/distance.c , will send in the fix shortly. will remove the change from here as it will be obsolete.

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>
@filbranden
Copy link
Member

Looks great, thanks!

@filbranden filbranden merged commit cd7c78e into numactl:master Jun 21, 2018
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