-
Notifications
You must be signed in to change notification settings - Fork 407
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
UCP: Copy memh flags from parent to child #9891
Conversation
@iyastreb can we add a unit test for it? |
Sure, good idea indeed! |
41f7582
to
b7b605d
Compare
src/ucp/core/ucp_mm.c
Outdated
@@ -1744,6 +1745,7 @@ ucp_memh_import_slow(ucp_context_h context, ucs_rcache_t *existing_rcache, | |||
user_memh->parent = memh; | |||
} else { | |||
memh = user_memh; | |||
memh->flags |= UCP_MEMH_FLAG_IMPORTED; |
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.
you can set it once for both cases outside of if..else
on line 1752 (and remove on line 1744)
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.
ok
test/gtest/ucp/test_ucp_mmap.cc
Outdated
} | ||
|
||
void test_ucp_mmap::test_rereg_imported_mem(ucp_mem_h memh, | ||
uint64_t memh_pack_flags, |
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.
seems memh_pack_flags
is not really needed
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.
ok
test/gtest/ucp/test_ucp_mmap.cc
Outdated
uint64_t memh_pack_flags, | ||
size_t size) | ||
ucp_mem_h test_ucp_mmap::import_memh(ucp_mem_h exported_memh, | ||
uint64_t memh_pack_flags) |
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.
seems this method is always packign exported key, so memh_pack_flags
is not really nedeed
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.
ok, true, I'll remove this param from this function and 2 others
test/gtest/ucp/test_ucp_mmap.cc
Outdated
~mem_chunk(); | ||
ucp_rkey_h unpack(ucp_ep_h, ucp_md_map_t md_map = 0); | ||
}; | ||
struct mem_chunk { |
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.
maybe move mem_chunk to test_ucp_mmap, so it will not be in top-level namespace?
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.
sure, why not
test/gtest/ucp/test_ucp_mmap.cc
Outdated
EXPECT_FALSE(mem.memh->flags & UCP_MEMH_FLAG_IMPORTED); | ||
|
||
ucp_mem_h imported_memh = import_memh(mem.memh); | ||
EXPECT_TRUE(!!(imported_memh->flags & UCP_MEMH_FLAG_IMPORTED)); |
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.
!! probably not needed here
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.
ok
4415e56
to
2e6e8f7
Compare
What
UCP_MEMH_FLAG_IMPORTED
was added in #8584, as the only memory handle flag. But this flag is only set in the memh parent, and never propagated to user memh. Despite that, flag is used on user memh:I think this flag must copied from parent to child in
ucp_memh_init_from_parent
, so that we can distinguish whether user memh is attached to imported memory or not