Commit 3f84955b authored by Hannes Payer's avatar Hannes Payer Committed by Commit Bot

[heap] Add accounting for committed memory of the Unmapper.

Change-Id: I26c2ba8d22aecac0e1d6a406eb90521ff52e1ec4
Reviewed-on: https://chromium-review.googlesource.com/1097119
Commit-Queue: Hannes Payer <hpayer@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53689}
parent 7ebbda48
...@@ -290,6 +290,13 @@ size_t Heap::CommittedOldGenerationMemory() { ...@@ -290,6 +290,13 @@ size_t Heap::CommittedOldGenerationMemory() {
return total + lo_space_->Size(); return total + lo_space_->Size();
} }
size_t Heap::CommittedMemoryOfHeapAndUnmapper() {
if (!HasBeenSetUp()) return 0;
return CommittedMemory() +
memory_allocator()->unmapper()->CommittedBufferedMemory();
}
size_t Heap::CommittedMemory() { size_t Heap::CommittedMemory() {
if (!HasBeenSetUp()) return 0; if (!HasBeenSetUp()) return 0;
...@@ -439,6 +446,10 @@ void Heap::PrintShortHeapStatistics() { ...@@ -439,6 +446,10 @@ void Heap::PrintShortHeapStatistics() {
", committed: %6" PRIuS " KB\n", ", committed: %6" PRIuS " KB\n",
lo_space_->SizeOfObjects() / KB, lo_space_->Available() / KB, lo_space_->SizeOfObjects() / KB, lo_space_->Available() / KB,
lo_space_->CommittedMemory() / KB); lo_space_->CommittedMemory() / KB);
PrintIsolate(isolate_,
"Unmapper buffering %d chunks of committed: %6" PRIuS " KB\n",
memory_allocator()->unmapper()->NumberOfChunks(),
CommittedMemoryOfHeapAndUnmapper() / KB);
PrintIsolate(isolate_, "All spaces, used: %6" PRIuS PrintIsolate(isolate_, "All spaces, used: %6" PRIuS
" KB" " KB"
", available: %6" PRIuS ", available: %6" PRIuS
......
...@@ -1451,6 +1451,10 @@ class Heap { ...@@ -1451,6 +1451,10 @@ class Heap {
// Returns the capacity of the old generation. // Returns the capacity of the old generation.
size_t OldGenerationCapacity(); size_t OldGenerationCapacity();
// Returns the amount of memory currently committed for the heap and memory
// held alive by the unmapper.
size_t CommittedMemoryOfHeapAndUnmapper();
// Returns the amount of memory currently committed for the heap. // Returns the amount of memory currently committed for the heap.
size_t CommittedMemory(); size_t CommittedMemory();
......
...@@ -439,6 +439,21 @@ int MemoryAllocator::Unmapper::NumberOfChunks() { ...@@ -439,6 +439,21 @@ int MemoryAllocator::Unmapper::NumberOfChunks() {
return static_cast<int>(result); return static_cast<int>(result);
} }
size_t MemoryAllocator::Unmapper::CommittedBufferedMemory() {
base::LockGuard<base::Mutex> guard(&mutex_);
size_t sum = 0;
// kPooled chunks are already uncommited. We only have to account for
// kRegular and kNonRegular chunks.
for (auto& chunk : chunks_[kRegular]) {
sum += chunk->size();
}
for (auto& chunk : chunks_[kNonRegular]) {
sum += chunk->size();
}
return sum;
}
bool MemoryAllocator::CommitMemory(Address base, size_t size) { bool MemoryAllocator::CommitMemory(Address base, size_t size) {
if (!SetPermissions(base, size, PageAllocator::kReadWrite)) { if (!SetPermissions(base, size, PageAllocator::kReadWrite)) {
return false; return false;
......
...@@ -1210,6 +1210,7 @@ class V8_EXPORT_PRIVATE MemoryAllocator { ...@@ -1210,6 +1210,7 @@ class V8_EXPORT_PRIVATE MemoryAllocator {
void EnsureUnmappingCompleted(); void EnsureUnmappingCompleted();
void TearDown(); void TearDown();
int NumberOfChunks(); int NumberOfChunks();
size_t CommittedBufferedMemory();
private: private:
static const int kReservedQueueingSlots = 64; static const int kReservedQueueingSlots = 64;
......
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