Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions ydb/library/actors/interconnect/rdma/mem_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ namespace NInterconnect::NRdma {
static_assert((MinAllocSz & (MinAllocSz - 1)) == 0, "MinAllocSz must be a power of 2");
static_assert((MaxAllocSz & (MaxAllocSz - 1)) == 0, "MaxAllocSz must be a power of 2");
static constexpr ui32 ChainsNum = GetNumChains(MinAllocSz, MaxAllocSz);
static constexpr ui32 BatchSizeBytes = 32 * 1024 * 1024; // 32 MB
static constexpr ui64 BatchSizeBytes = 32 * 1024 * 1024; // 32 MB

static constexpr ui32 GetChainIndex(ui32 size) noexcept {
return GetPowerOfTwo(std::max(size, MinAllocSz)) - GetPowerOfTwo(MinAllocSz);
Expand Down Expand Up @@ -609,10 +609,12 @@ namespace NInterconnect::NRdma {
if (!settings.has_value())
return 128; //default

if (settings->SizeLimitMb * 1024 * 1024 < BatchSizeBytes)
const ui64 sizeLimit = settings->SizeLimitMb * (1ull << 20);

if (sizeLimit < BatchSizeBytes)
return 1; //Do not allow zerro limit

return settings->SizeLimitMb * 1024 * 1024 / BatchSizeBytes;
return sizeLimit / BatchSizeBytes;
}
public:
TSlotMemPool(NMonitoring::TDynamicCounterPtr counter, const std::optional<TMemPoolSettings>& settings)
Expand Down
Loading