Commit 63f7a4e7 authored by haraken's avatar haraken Committed by Commit bot

PartitionAlloc: Increase the number of pages per bucket

Currently the number of pages per bucket is limited to 2^16,
and this has caused a bunch of crash reports at partitionBucketFull().

This CL increase the limit to 2^24 instead of decreasing the limit of
|numSystemPagesPerSlotSpan| to 2^8 (It is statically guaranteed that |numSystemPagesPerSlotSpan|
does not exceed 2^8). As a result, this CL doesn't change sizeof(PartitionBucket).

BUG=87772

Review URL: https://codereview.chromium.org/1622553004

Cr-Commit-Position: refs/heads/master@{#371745}
parent 8dd34a13
......@@ -51,6 +51,7 @@ static_assert(WTF::kPageMetadataSize * WTF::kNumPartitionPagesPerSuperPage <= WT
// Check that some of our zanier calculations worked out as expected.
static_assert(WTF::kGenericSmallestBucket == 8, "generic smallest bucket");
static_assert(WTF::kGenericMaxBucketed == 983040, "generic max bucketed");
static_assert(WTF::kMaxSystemPagesPerSlotSpan < (1 << 8), "System pages per slot span must be less than 128.");
namespace WTF {
......@@ -62,7 +63,7 @@ void (*PartitionRootBase::gOomHandlingFunction)() = nullptr;
PartitionAllocHooks::AllocationHook* PartitionAllocHooks::m_allocationHook = nullptr;
PartitionAllocHooks::FreeHook* PartitionAllocHooks::m_freeHook = nullptr;
static uint16_t partitionBucketNumSystemPages(size_t size)
static uint8_t partitionBucketNumSystemPages(size_t size)
{
// This works out reasonably for the current bucket sizes of the generic
// allocator, and the current values of partition page size and constants.
......@@ -78,7 +79,9 @@ static uint16_t partitionBucketNumSystemPages(size_t size)
uint16_t bestPages = 0;
if (size > kMaxSystemPagesPerSlotSpan * kSystemPageSize) {
ASSERT(!(size % kSystemPageSize));
return static_cast<uint16_t>(size / kSystemPageSize);
bestPages = static_cast<uint16_t>(size / kSystemPageSize);
RELEASE_ASSERT(bestPages < (1 << 8));
return static_cast<uint8_t>(bestPages);
}
ASSERT(size <= kMaxSystemPagesPerSlotSpan * kSystemPageSize);
for (uint16_t i = kNumSystemPagesPerPartitionPage - 1; i <= kMaxSystemPagesPerSlotSpan; ++i) {
......@@ -97,7 +100,8 @@ static uint16_t partitionBucketNumSystemPages(size_t size)
}
}
ASSERT(bestPages > 0);
return bestPages;
RELEASE_ASSERT(bestPages <= kMaxSystemPagesPerSlotSpan);
return static_cast<uint8_t>(bestPages);
}
static void partitionAllocBaseInit(PartitionRootBase* root)
......
......@@ -259,8 +259,8 @@ struct PartitionBucket {
PartitionPage* emptyPagesHead;
PartitionPage* decommittedPagesHead;
uint32_t slotSize;
uint16_t numSystemPagesPerSlotSpan;
uint16_t numFullPages;
unsigned numSystemPagesPerSlotSpan : 8;
unsigned numFullPages : 24;
};
// An "extent" is a span of consecutive superpages. We link to the partition's
......
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