-
Notifications
You must be signed in to change notification settings - Fork 54
Allow slicing a whole memory region #84
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
base: main
Are you sure you want to change the base?
Conversation
ibverbs/src/lib.rs
Outdated
| /// Make a lifetime-independent slice representation of this memory region. | ||
| /// Unlike `LocalMemorySlice`, this supports 64-bit memory region lengths. | ||
| pub fn as_slice(&self) -> MemoryRegionSlice { | ||
| let bounds = (..unsafe { *self.inner.mr }.length); |
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.
these lines here seem obsolete, no need to recalculate the addr and length if we are taking the full range
ibverbs/src/lib.rs
Outdated
| } | ||
|
|
||
| impl MemoryRegionSlice { | ||
| /// Get the address of the memory region. |
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 just make the struct fields pub instead of these getter methods
| } | ||
|
|
||
| /// Make a slice of this memory region. | ||
| pub fn slice(&self, bounds: impl RangeBounds<usize>) -> LocalMemorySlice { |
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.
what is your use case for needing something lifetime independent?
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.
It can be useful to move MemoryRegion into a generic (rdma-agnostic) custom buffer pool struct, which, on drop, will call the MemoryRegion's destructor, thus deregistering the region right before deallocating the application memory. Thus, we need to be able to create slices outside of the MemoryRegion's lifetime
This allows 64-bit slices unlike LocalMemoryRegion