Skip to content

Conversation

@arajni3
Copy link

@arajni3 arajni3 commented Dec 4, 2025

This allows 64-bit slices unlike LocalMemoryRegion

/// 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);
Copy link
Collaborator

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

}

impl MemoryRegionSlice {
/// Get the address of the memory region.
Copy link
Collaborator

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 {
Copy link
Collaborator

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?

Copy link
Author

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

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