Commit 348c758d authored by Bill Budge's avatar Bill Budge Committed by Commit Bot

Reland [partition_alloc] Allow 2 GiB direct mapped allocations.

- Raises the limit of direct mapped allocations. WASM needs
  to be able to allocate 2GiB regions.

Bug: chromium:801604
Change-Id: I77e905ff4ae6f5ca66de9daf30f19bb6f7b54089
Reviewed-on: https://chromium-review.googlesource.com/875301Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#530380}
parent 19bd94e2
...@@ -34,6 +34,9 @@ static_assert(sizeof(base::PartitionSuperPageExtentEntry) <= ...@@ -34,6 +34,9 @@ static_assert(sizeof(base::PartitionSuperPageExtentEntry) <=
static_assert(base::kPageMetadataSize * base::kNumPartitionPagesPerSuperPage <= static_assert(base::kPageMetadataSize * base::kNumPartitionPagesPerSuperPage <=
base::kSystemPageSize, base::kSystemPageSize,
"page metadata fits in hole"); "page metadata fits in hole");
// Limit to prevent callers accidentally overflowing an int size.
static_assert(base::kGenericMaxDirectMapped <= 1UL << 31,
"maximum direct mapped allocation");
// Check that some of our zanier calculations worked out as expected. // Check that some of our zanier calculations worked out as expected.
static_assert(base::kGenericSmallestBucket == 8, "generic smallest bucket"); static_assert(base::kGenericSmallestBucket == 8, "generic smallest bucket");
static_assert(base::kGenericMaxBucketed == 983040, "generic max bucketed"); static_assert(base::kGenericMaxBucketed == 983040, "generic max bucketed");
......
...@@ -206,7 +206,7 @@ static const size_t kGenericMaxBucketed = ...@@ -206,7 +206,7 @@ static const size_t kGenericMaxBucketed =
static const size_t kGenericMinDirectMappedDownsize = static const size_t kGenericMinDirectMappedDownsize =
kGenericMaxBucketed + kGenericMaxBucketed +
1; // Limit when downsizing a direct mapping using realloc(). 1; // Limit when downsizing a direct mapping using realloc().
static const size_t kGenericMaxDirectMapped = INT_MAX - kSystemPageSize; static const size_t kGenericMaxDirectMapped = 1UL << 31; // 2 GiB
static const size_t kBitsPerSizeT = sizeof(void*) * CHAR_BIT; static const size_t kBitsPerSizeT = sizeof(void*) * CHAR_BIT;
// Constants for the memory reclaim logic. // Constants for the memory reclaim logic.
......
...@@ -859,7 +859,7 @@ TEST_F(PartitionAllocTest, GenericAllocGetSize) { ...@@ -859,7 +859,7 @@ TEST_F(PartitionAllocTest, GenericAllocGetSize) {
} }
// Too large allocation. // Too large allocation.
requested_size = INT_MAX; requested_size = (1UL << 31) + 1;
predicted_size = generic_allocator.root()->ActualSize(requested_size); predicted_size = generic_allocator.root()->ActualSize(requested_size);
EXPECT_EQ(requested_size, predicted_size); EXPECT_EQ(requested_size, predicted_size);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment