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

numademo: fix wrong node input #32

Merged
merged 1 commit into from
Jun 21, 2018

Conversation

harish-24
Copy link
Contributor

@harish-24 harish-24 commented Jun 20, 2018

In few sparse node systems, test fails with invalid argument at set_mempolicy through numa_preferred_node. Patch fixes it by providing a valid wrong node.
Tested on both sparse and contiguous types of nodes.

Signed-off-by: Harish harish@linux.vnet.ibm.com

@@ -436,7 +436,7 @@ void test(enum test type)
numa_set_localalloc();
memtest("local allocation", numa_alloc(msize));

numa_set_preferred((node_to_use[i]+1) % numnodes );
Copy link
Member

Choose a reason for hiding this comment

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

This code preceded memtest("setting wrong preferred node", numa_alloc(msize));, but after your change it behaves just the same as memtest("setting wrong preferred node", numa_alloc(msize));...

In a way, this is trying to find the "next" node to create a mismatch.

Perhaps a possible approach would be earlier on when listing valid nodes create a map that points to the next valid node from the current one?

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps this might work?

numa_set_preferred(node_to_use[(i + 1) % numnodes]);

That assumes that above in get_node_list(), got_nodes in the end matches numnodes, perhaps adding an assertion for that would be good there...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@filbranden The actual trick I missed earlier and this fix is the precedence with which i was used. As you pointed out, (node_to_use[(i + 1) % numnodes]) rightly provides "wrongly preferred node". And yes, got_nodes should match the numnodes, i have added a check for it.

In few sparse node systems, test fails with invalid argument at
set_mempolicy through numa_preferred_node. Patch fixes it by
providing a valid wrong node.

Signed-off-by: Harish <harish@linux.vnet.ibm.com>
@filbranden filbranden merged commit 2b190af 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