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

Unified Diff: third_party/tcmalloc/chromium/src/deep-heap-profile.cc

Issue 12575008: Dump stats of memory pages which are hooked, but absent from /proc/<pid>/maps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
Index: third_party/tcmalloc/chromium/src/deep-heap-profile.cc
diff --git a/third_party/tcmalloc/chromium/src/deep-heap-profile.cc b/third_party/tcmalloc/chromium/src/deep-heap-profile.cc
index 173b244c7a2c56576fce0814b376cbc0aab58667..748e58c885b9fed598395f9fbe96ee3ff6c0e5c2 100644
--- a/third_party/tcmalloc/chromium/src/deep-heap-profile.cc
+++ b/third_party/tcmalloc/chromium/src/deep-heap-profile.cc
@@ -704,6 +704,10 @@ void DeepHeapProfile::GlobalStats::SnapshotMaps(
}
if (last_address_of_unhooked + 1 > cursor) {
+ RAW_CHECK(cursor >= first_address,
+ "Wrong calculation for unhooked");
+ RAW_CHECK(last_address_of_unhooked <= last_address,
+ "Wrong calculation for unhooked");
uint64 committed_size = unhooked_[type].Record(
memory_residence_info_getter,
cursor,
@@ -748,6 +752,37 @@ void DeepHeapProfile::GlobalStats::SnapshotMaps(
mmap_iter->end_addr - 1 <= last_address);
}
}
+
+ // TODO(dmikurube): Investigate and fix http://crbug.com/189114.
+ //
+ // The total committed memory usage in all_ (from /proc/<pid>/maps) is
+ // sometimes smaller than the sum of the committed mmap'ed addresses and
+ // unhooked regions. Within our observation, the difference was only 4KB
+ // in committed usage, zero in reserved virtual addresses
+ //
+ // A guess is that an uncommitted (but reserved) page may become committed
+ // during counting memory usage in the loop above.
+ //
+ // The difference is accounted as "ABSENT" to investigate such cases.
+
+ RegionStats all_total;
+ RegionStats unhooked_total;
+ for (int i = 0; i < NUMBER_OF_MAPS_REGION_TYPES; ++i) {
+ all_total.AddAnotherRegionStat(all_[i]);
+ unhooked_total.AddAnotherRegionStat(unhooked_[i]);
+ }
+
+ size_t absent_virtual = profiled_mmap_.virtual_bytes() +
+ unhooked_total.virtual_bytes() -
+ all_total.virtual_bytes();
+ if (absent_virtual > 0)
+ all_[ABSENT].AddToVirtualBytes(absent_virtual);
+
+ size_t absent_committed = profiled_mmap_.committed_bytes() +
+ unhooked_total.committed_bytes() -
+ all_total.committed_bytes();
+ if (absent_committed > 0)
+ all_[ABSENT].AddToCommittedBytes(absent_committed);
}
void DeepHeapProfile::GlobalStats::SnapshotAllocations(
@@ -786,6 +821,7 @@ void DeepHeapProfile::GlobalStats::Unparse(TextBuffer* buffer) {
buffer->AppendString("\n", 0);
all_total.Unparse("total", buffer);
+ all_[ABSENT].Unparse("absent", buffer);
all_[FILE_EXEC].Unparse("file-exec", buffer);
all_[FILE_NONEXEC].Unparse("file-nonexec", buffer);
all_[ANONYMOUS].Unparse("anonymous", buffer);

Powered by Google App Engine
This is Rietveld 408576698