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

Unified Diff: content/browser/zygote_host_linux.cc

Issue 7671033: Changing OOM range to 0, 1000 and tweaking OOM algorithm. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More review changes Created 9 years, 4 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 | « content/browser/zygote_host_linux.h ('k') | sandbox/linux/suid/process_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/zygote_host_linux.cc
diff --git a/content/browser/zygote_host_linux.cc b/content/browser/zygote_host_linux.cc
index 42ee6da5c0f270fb353e2f78e46ecb0c1ef22213..2b9e5de22ae9e0c7a7fb674f343444ae8b8c5fb9 100644
--- a/content/browser/zygote_host_linux.cc
+++ b/content/browser/zygote_host_linux.cc
@@ -272,28 +272,35 @@ pid_t ZygoteHost::ForkRequest(
return base::kNullProcessHandle;
}
- const int kRendererScore = 5;
- AdjustRendererOOMScore(pid, kRendererScore);
+ // This is just a starting score for a renderer or extension (the
+ // only types of processes that will be started this way). It will
+ // get adjusted as time goes on. (This is the same value as
+ // chrome::kLowestRendererOomScore in chrome/chrome_constants.h, but
+ // that's not something we can include here.)
+ const int kLowestRendererOomScore = 300;
+ AdjustRendererOOMScore(pid, kLowestRendererOomScore);
return pid;
}
void ZygoteHost::AdjustRendererOOMScore(base::ProcessHandle pid, int score) {
- // 1) You can't change the oom_adj of a non-dumpable process (EPERM) unless
- // you're root. Because of this, we can't set the oom_adj from the browser
- // process.
+ // 1) You can't change the oom_score_adj of a non-dumpable process
+ // (EPERM) unless you're root. Because of this, we can't set the
+ // oom_adj from the browser process.
//
- // 2) We can't set the oom_adj before entering the sandbox because the
- // zygote is in the sandbox and the zygote is as critical as the browser
- // process. Its oom_adj value shouldn't be changed.
+ // 2) We can't set the oom_score_adj before entering the sandbox
+ // because the zygote is in the sandbox and the zygote is as
+ // critical as the browser process. Its oom_adj value shouldn't
+ // be changed.
//
- // 3) A non-dumpable process can't even change its own oom_adj because it's
- // root owned 0644. The sandboxed processes don't even have /proc, but one
- // could imagine passing in a descriptor from outside.
+ // 3) A non-dumpable process can't even change its own oom_score_adj
+ // because it's root owned 0644. The sandboxed processes don't
+ // even have /proc, but one could imagine passing in a descriptor
+ // from outside.
//
// So, in the normal case, we use the SUID binary to change it for us.
// However, Fedora (and other SELinux systems) don't like us touching other
- // process's oom_adj values
+ // process's oom_score_adj (or oom_adj) values
// (https://bugzilla.redhat.com/show_bug.cgi?id=581256).
//
// The offical way to get the SELinux mode is selinux_getenforcemode, but I
« no previous file with comments | « content/browser/zygote_host_linux.h ('k') | sandbox/linux/suid/process_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698