Open
Conversation
xmakro
reviewed
Dec 4, 2025
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); |
Collaborator
There was a problem hiding this comment.
these lines here seem obsolete, no need to recalculate the addr and length if we are taking the full range
xmakro
reviewed
Dec 4, 2025
ibverbs/src/lib.rs
Outdated
| } | ||
|
|
||
| impl MemoryRegionSlice { | ||
| /// Get the address of the memory region. |
Collaborator
There was a problem hiding this comment.
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 { |
Collaborator
There was a problem hiding this comment.
what is your use case for needing something lifetime independent?
Author
There was a problem hiding this comment.
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
added 2 commits
December 4, 2025 15:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows 64-bit slices unlike LocalMemoryRegion