diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-10 02:08:10 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-10 02:08:10 +0000 |
commit | e5856a7a015a8a4d790b51136881a32364ee912a (patch) | |
tree | c96a355ab2e2f663770f4c123244b28031a82b52 /base/process_util.h | |
parent | 8a0590e6696b0a6377cfc4cb71fa66beeef047d6 (diff) | |
download | chromium_src-e5856a7a015a8a4d790b51136881a32364ee912a.zip chromium_src-e5856a7a015a8a4d790b51136881a32364ee912a.tar.gz chromium_src-e5856a7a015a8a4d790b51136881a32364ee912a.tar.bz2 |
Linux: Adjust /proc/pid/oom_adj to sacrifice plugin and renderer processes to the OOM killer.
BUG=29752
TEST=During out of memory conditions, Linux kernel picks a plugin/renderer over the browser process.
Review URL: http://codereview.chromium.org/467058
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34222 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util.h')
-rw-r--r-- | base/process_util.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/base/process_util.h b/base/process_util.h index 41d1d17..1122de7 100644 --- a/base/process_util.h +++ b/base/process_util.h @@ -100,6 +100,13 @@ FilePath GetProcessExecutablePath(ProcessHandle process); // CPU-related ticks. Returns -1 on parse error. // Exposed for testing. int ParseProcStatCPU(const std::string& input); + +static const char kAdjustOOMScoreSwitch[] = "--adjust-oom-score"; + +// This adjusts /proc/process/oom_adj so the Linux OOM killer will prefer +// certain process types over others. The range for the adjustment is +// [-17,15], with [0,15] being user accessible. +bool AdjustOOMScore(ProcessId process, int score); #endif #if defined(OS_POSIX) |