Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Unified Diff: Source/wtf/PartitionAlloc.cpp

Issue 649583004: PartitionAlloc: Count direct mapped pages as committed (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/wtf/PartitionAlloc.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/PartitionAlloc.cpp
diff --git a/Source/wtf/PartitionAlloc.cpp b/Source/wtf/PartitionAlloc.cpp
index 3ba965297d9ba85cbd9dd873a8778b2de68e049e..647407d0bb8657cfa3b4a6596cf319c16efa0909 100644
--- a/Source/wtf/PartitionAlloc.cpp
+++ b/Source/wtf/PartitionAlloc.cpp
@@ -329,6 +329,8 @@ static ALWAYS_INLINE void* partitionAllocPartitionPages(PartitionRootBase* root,
RELEASE_ASSERT(numPartitionPages <= kNumPartitionPagesPerSuperPage);
size_t totalSize = kPartitionPageSize * numPartitionPages;
root->totalSizeOfCommittedPages += totalSize;
+ if (root->totalSizeOfCommittedPages > kMaxPartitionSize)
+ partitionFull();
size_t numPartitionPagesLeft = (root->nextPartitionPageEnd - root->nextPartitionPage) >> kPartitionPageShift;
if (LIKELY(numPartitionPagesLeft >= numPartitionPages)) {
// In this case, we can still hand out pages from the current super page
@@ -340,8 +342,6 @@ static ALWAYS_INLINE void* partitionAllocPartitionPages(PartitionRootBase* root,
// Need a new super page.
root->totalSizeOfSuperPages += kSuperPageSize;
- if (root->totalSizeOfSuperPages > kMaxPartitionSize)
- partitionFull();
char* requestedAddress = root->nextSuperPage;
char* superPage = reinterpret_cast<char*>(allocPages(requestedAddress, kSuperPageSize, kSuperPageSize));
if (UNLIKELY(!superPage)) {
@@ -578,6 +578,10 @@ static ALWAYS_INLINE void* partitionDirectMap(PartitionRootBase* root, int flags
mapSize += kPageAllocationGranularityOffsetMask;
mapSize &= kPageAllocationGranularityBaseMask;
+ root->totalSizeOfCommittedPages += size;
Chris Evans 2014/10/15 22:06:16 I think we might as well try and be fully accurate
Jens Widell 2014/10/16 11:09:53 Done.
+ if (root->totalSizeOfCommittedPages > kMaxPartitionSize)
+ partitionFull();
+
// TODO: we may want to let the operating system place these allocations
// where it pleases. On 32-bit, this might limit address space
// fragmentation and on 64-bit, this might have useful savings for TLB
@@ -634,6 +638,9 @@ static ALWAYS_INLINE void partitionDirectUnmap(PartitionPage* page)
// page.
unmapSize += kPartitionPageSize + kSystemPageSize;
+ PartitionRootBase* root = partitionPageToRoot(page);
+ root->totalSizeOfCommittedPages -= page->bucket->slotSize;
Chris Evans 2014/10/15 22:06:16 + kSystemPageSize as per above?
Jens Widell 2014/10/16 11:09:53 Done.
+
ASSERT(!(unmapSize & kPageAllocationGranularityOffsetMask));
char* ptr = reinterpret_cast<char*>(partitionPageToPointer(page));
« no previous file with comments | « Source/wtf/PartitionAlloc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698