зеркало из https://github.com/mozilla/gecko-dev.git
Bug 785171 - Support OOM adjustment via /proc/<pid>/oom_score_adj. r=dhylands
The interface /proc/<pid>/oom_score_adj has been added as a replacement for /proc/<pid>/oom_adj. It is now supported and used by default within Gonk. If oom_scrore_adj is not available, the code falls back to the old interface.
This commit is contained in:
Родитель
c0eb9590b3
Коммит
136083f5b7
|
@ -907,10 +907,17 @@ SetProcessPriority(int aPid, ProcessPriority aPriority)
|
|||
aPid, clampedOomScoreAdj));
|
||||
}
|
||||
|
||||
int oomAdj = oomAdjOfOomScoreAdj(clampedOomScoreAdj);
|
||||
// We try the newer interface first, and fall back to the older interface
|
||||
// on failure.
|
||||
|
||||
WriteToFile(nsPrintfCString("/proc/%d/oom_adj", aPid).get(),
|
||||
nsPrintfCString("%d", oomAdj).get());
|
||||
if (!WriteToFile(nsPrintfCString("/proc/%d/oom_score_adj", aPid).get(),
|
||||
nsPrintfCString("%d", clampedOomScoreAdj).get()))
|
||||
{
|
||||
int oomAdj = oomAdjOfOomScoreAdj(clampedOomScoreAdj);
|
||||
|
||||
WriteToFile(nsPrintfCString("/proc/%d/oom_adj", aPid).get(),
|
||||
nsPrintfCString("%d", oomAdj).get());
|
||||
}
|
||||
}
|
||||
|
||||
int32_t nice = 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче