Skip to content

Commit

Permalink
FEXCore/Allocator: Ensure small reservations aren't used
Browse files Browse the repository at this point in the history
Anything less than three pages can't be used for FEX allocations due to
VMA implementation details. Plus we may have reduced a single page
reservation to zero with the prior ObjectAlloc size reservation.
  • Loading branch information
Sonicadvance1 committed Jan 24, 2025
1 parent 310b40e commit 9ba206a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions FEXCore/Source/Utils/Allocator/64BitAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,10 @@ void OSAllocator_64Bit::AllocateMemoryRegions(fextl::vector<FEXCore::Allocator::
}

for (auto [Ptr, AllocationSize] : Ranges) {
// Skip size of zero if ObjectAllocSize matched the size of region.
if (AllocationSize == 0) continue;
// Skip using any regions that are <= two pages. FEX's VMA allocator requires two pages
// for tracking data. So three pages are minimum for a single page VMA allocation.
if (AllocationSize <= (FEXCore::Utils::FEX_PAGE_SIZE * 2)) continue;

ReservedVMARegion* Region = ObjectAlloc->new_construct<ReservedVMARegion>();
Region->Base = reinterpret_cast<uint64_t>(Ptr);
Region->RegionSize = AllocationSize;
Expand Down

0 comments on commit 9ba206a

Please sign in to comment.