libmeminfo: Blacklist [vectors] VMA
am: 70663b102b
Change-Id: I955fe0b202df698b08eb40ec25a773f37d349b44
diff --git a/procmeminfo.cpp b/procmeminfo.cpp
index e755ff1..85c6562 100644
--- a/procmeminfo.cpp
+++ b/procmeminfo.cpp
@@ -41,6 +41,10 @@
namespace android {
namespace meminfo {
+// List of VMA names that we don't want to process:
+// - On ARM32, [vectors] is a special VMA that is outside of pagemap range.
+static const std::vector<std::string> g_blacklisted_vmas = {"[vectors]"};
+
static void add_mem_usage(MemUsage* to, const MemUsage& from) {
to->vss += from.vss;
to->rss += from.rss;
@@ -143,7 +147,12 @@
return maps_;
}
- auto collect_vmas = [&](const Vma& vma) { maps_.emplace_back(vma); };
+ auto collect_vmas = [&](const Vma& vma) {
+ if (std::find(g_blacklisted_vmas.begin(), g_blacklisted_vmas.end(), vma.name) ==
+ g_blacklisted_vmas.end()) {
+ maps_.emplace_back(vma);
+ }
+ };
if (path.empty() && !ForEachVma(collect_vmas)) {
LOG(ERROR) << "Failed to read smaps for Process " << pid_;
maps_.clear();
@@ -267,7 +276,10 @@
if (!::android::procinfo::ReadMapFile(
maps_file, [&](uint64_t start, uint64_t end, uint16_t flags, uint64_t pgoff, ino_t,
const char* name) {
- maps_.emplace_back(Vma(start, end, pgoff, flags, name));
+ if (std::find(g_blacklisted_vmas.begin(), g_blacklisted_vmas.end(), name) ==
+ g_blacklisted_vmas.end()) {
+ maps_.emplace_back(Vma(start, end, pgoff, flags, name));
+ }
})) {
LOG(ERROR) << "Failed to parse " << maps_file;
maps_.clear();