summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2015-10-23 13:15:07 -0400
committerThan McIntosh <thanm@google.com>2015-10-23 13:15:07 -0400
commitfd6bb2d486084a0eeeb11767b17234cf4a23159d (patch)
treefa948a8cac353b5cebb7040ff8202ac80768e323
parent6fea45816ae5ce22b9f186a1fc4b447a42ece10f (diff)
downloadextras-fd6bb2d486084a0eeeb11767b17234cf4a23159d.tar.gz
Reduce oom_score_adj to zero for perfprofd.
Up until this point perfprofd has inherited a decreased OOM score of -1000 from init -- this doens't make sense given that perfprofd is not a critical system service. This fixes perfprofd to reduce its oom_score_adj to 0. Bug: 25216630 Change-Id: Ica8a300d8c33016bcbd3b0ecd25393828654878e
-rw-r--r--perfprofd/perfprofdcore.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/perfprofd/perfprofdcore.cc b/perfprofd/perfprofdcore.cc
index 3fb532c1..d9ed2b03 100644
--- a/perfprofd/perfprofdcore.cc
+++ b/perfprofd/perfprofdcore.cc
@@ -828,6 +828,15 @@ static void init(ConfigReader &config)
config.getConfigFilePath());
}
+ // Children of init inherit an artificially low OOM score -- this is not
+ // desirable for perfprofd (its OOM score should be on par with
+ // other user processes).
+ std::stringstream oomscore_path;
+ oomscore_path << "/proc/" << getpid() << "/oom_score_adj";
+ if (!android::base::WriteStringToFile("0", oomscore_path.str())) {
+ W_ALOGE("unable to write to %s", oomscore_path.str().c_str());
+ }
+
set_seed(config);
cleanup_destination_dir(config);