Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Currently `nextPowerOfTwo` uses 32-bit literal to construct `lower`, which will overflow for the input >= 2^32. A bug introduced by this: When `AllocationPool` needs to allocation new memory from memory pool, it requests memory double the size of the previous allocation and cap at `kMaxMmapBytes` which is 512MB. But now, after some allocations, `nextPowerOfTwo` overflows and `AllocationPool` only allocates 16 huge pages. Allocate requests' size to memory pool at `AllocationPool::newRunImpl` ``` Without fix: 64KB | 64KB | 64KB | 64KB | 32MB | 64MB | 128MB | 256MB | 512MB | 512MB | 512MB | 512MB | 512MB | 512MB | 512MB | 512MB | 32MB | 32MB | 32MB ... With fix: 64KB | 64KB | 64KB | 64KB | 32MB | 64MB | 128MB | 256MB | 512MB | 512MB | 512MB | 512MB | 512MB | 512MB | 512MB | 512MB | 512MB | 512MB | 512MB ... ``` To fix, use 64-bit literal instead. Pull Request resolved: #7531 Reviewed By: Yuhta Differential Revision: D51524257 Pulled By: mbasmanova fbshipit-source-id: 27b1f592396b26f04fba566b013551459b30651a
- Loading branch information