Skip to content

Commit

Permalink
[TransferEngine] Correct the count of slice_quque_ in rdma/worker_poo…
Browse files Browse the repository at this point in the history
…l, remove the repeated check for overlap (#79)

* correct the count of slice_queue_, although it has no adverse effects

Signed-off-by: fengquyoumo <1455117463@qq.com>

* The overlap check in rdma_transport is repeat with checkOverlap in TransferEngine::registerLocalMemory which is better

Signed-off-by: fengquyoumo <1455117463@qq.com>

---------

Signed-off-by: fengquyoumo <1455117463@qq.com>
  • Loading branch information
fengquyoumo authored Jan 14, 2025
1 parent 00ca6cd commit dd2b56b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,28 +193,6 @@ int RdmaContext::deconstruct() {
}

int RdmaContext::registerMemoryRegion(void *addr, size_t length, int access) {
// Currently if the memory region overlaps with existing one, return
// negative value Or Merge it with existing mr?
{
RWSpinlock::ReadGuard guard(memory_regions_lock_);
for (const auto &entry : memory_region_list_) {
bool start_overlapped = entry->addr <= addr &&
addr < (char *)entry->addr + entry->length;
bool end_overlapped =
entry->addr < (char *)addr + length &&
(char *)addr + length <= (char *)entry->addr + entry->length;
bool covered =
addr <= entry->addr &&
(char *)entry->addr + entry->length <= (char *)addr + length;
if (start_overlapped || end_overlapped || covered) {
LOG(ERROR) << "Failed to register memory " << addr
<< ": overlap existing memory regions";
return ERR_ADDRESS_OVERLAPPED;
}
}
}

// No overlap, continue
ibv_mr *mr = ibv_reg_mr(pd_, addr, length, access);
if (!mr) {
PLOG(ERROR) << "Failed to register memory " << addr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ int WorkerPool::submitPostSend(
slice_queue_lock_[shard_id].lock();
for (auto &slice : slice_list_map[shard_id])
slice_queue_[shard_id][slice->peer_nic_path].push_back(slice);
slice_queue_count_[shard_id].fetch_add(submitted_slice_count,
slice_queue_count_[shard_id].fetch_add(slice_list_map[shard_id].size(),
std::memory_order_relaxed);
slice_queue_lock_[shard_id].unlock();
}
Expand Down

0 comments on commit dd2b56b

Please sign in to comment.