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
12 changes: 7 additions & 5 deletions src/gpgmm/common/SlabMemoryAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ namespace gpgmm {
// Get the next free slab.
if (mLastUsedSlabSize > 0) {
uint64_t newSlabSize =
std::min(ComputeSlabSize(request.SizeInBytes, slabSize * mSlabGrowthFactor,
std::min(ComputeSlabSize(request.SizeInBytes,
static_cast<uint64_t>(slabSize * mSlabGrowthFactor),
request.AvailableForAllocation),
mMaxSlabSize);

Expand Down Expand Up @@ -296,10 +297,11 @@ namespace gpgmm {
// If a subsequent TryAllocateMemory() uses a request size different than the current
// request size, memory required for the next slab could be the wrong size. If so,
// pre-fetching did not pay off and the pre-fetched memory will be de-allocated instead.
uint64_t nextSlabSize =
std::min(ComputeSlabSize(request.SizeInBytes, mLastUsedSlabSize * mSlabGrowthFactor,
request.AvailableForAllocation),
mMaxSlabSize);
uint64_t nextSlabSize = std::min(
ComputeSlabSize(request.SizeInBytes,
static_cast<uint64_t>(mLastUsedSlabSize * mSlabGrowthFactor),
request.AvailableForAllocation),
mMaxSlabSize);

// If under growth phase (and accounting that the current slab will soon become
// full), reset the slab size back to the last size. Otherwise, the pre-fetch will
Expand Down