mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 979205 - Make LMK and low-mem trigger preferences use values in KiB instead of MiB. r=fabrice
This commit is contained in:
parent
475462ffca
commit
8eb959fe27
@ -642,48 +642,48 @@ pref("dom.ipc.processPriorityManager.backgroundLRUPoolLevels", 5);
|
||||
// /still/ have the same niceness; we'd effectively have erased NSPR's thread
|
||||
// priorities.
|
||||
|
||||
// The kernel can only accept 6 (OomScoreAdjust, KillUnderMB) pairs. But it is
|
||||
// The kernel can only accept 6 (OomScoreAdjust, KillUnderKB) pairs. But it is
|
||||
// okay, kernel will still kill processes with larger OomScoreAdjust first even
|
||||
// its OomScoreAdjust don't have a corresponding KillUnderMB.
|
||||
// its OomScoreAdjust don't have a corresponding KillUnderKB.
|
||||
|
||||
pref("hal.processPriorityManager.gonk.MASTER.OomScoreAdjust", 0);
|
||||
pref("hal.processPriorityManager.gonk.MASTER.KillUnderMB", 4);
|
||||
pref("hal.processPriorityManager.gonk.MASTER.KillUnderKB", 4096);
|
||||
pref("hal.processPriorityManager.gonk.MASTER.Nice", 0);
|
||||
|
||||
pref("hal.processPriorityManager.gonk.FOREGROUND_HIGH.OomScoreAdjust", 67);
|
||||
pref("hal.processPriorityManager.gonk.FOREGROUND_HIGH.KillUnderMB", 5);
|
||||
pref("hal.processPriorityManager.gonk.FOREGROUND_HIGH.KillUnderKB", 5120);
|
||||
pref("hal.processPriorityManager.gonk.FOREGROUND_HIGH.Nice", 0);
|
||||
|
||||
pref("hal.processPriorityManager.gonk.FOREGROUND.OomScoreAdjust", 134);
|
||||
pref("hal.processPriorityManager.gonk.FOREGROUND.KillUnderMB", 6);
|
||||
pref("hal.processPriorityManager.gonk.FOREGROUND.KillUnderKB", 6144);
|
||||
pref("hal.processPriorityManager.gonk.FOREGROUND.Nice", 1);
|
||||
|
||||
pref("hal.processPriorityManager.gonk.FOREGROUND_KEYBOARD.OomScoreAdjust", 200);
|
||||
pref("hal.processPriorityManager.gonk.FOREGROUND_KEYBOARD.Nice", 1);
|
||||
|
||||
pref("hal.processPriorityManager.gonk.BACKGROUND_PERCEIVABLE.OomScoreAdjust", 400);
|
||||
pref("hal.processPriorityManager.gonk.BACKGROUND_PERCEIVABLE.KillUnderMB", 7);
|
||||
pref("hal.processPriorityManager.gonk.BACKGROUND_PERCEIVABLE.KillUnderKB", 7168);
|
||||
pref("hal.processPriorityManager.gonk.BACKGROUND_PERCEIVABLE.Nice", 7);
|
||||
|
||||
pref("hal.processPriorityManager.gonk.BACKGROUND_HOMESCREEN.OomScoreAdjust", 534);
|
||||
pref("hal.processPriorityManager.gonk.BACKGROUND_HOMESCREEN.KillUnderMB", 8);
|
||||
pref("hal.processPriorityManager.gonk.BACKGROUND_HOMESCREEN.KillUnderKB", 8192);
|
||||
pref("hal.processPriorityManager.gonk.BACKGROUND_HOMESCREEN.Nice", 18);
|
||||
|
||||
pref("hal.processPriorityManager.gonk.BACKGROUND.OomScoreAdjust", 667);
|
||||
pref("hal.processPriorityManager.gonk.BACKGROUND.KillUnderMB", 20);
|
||||
pref("hal.processPriorityManager.gonk.BACKGROUND.KillUnderKB", 20480);
|
||||
pref("hal.processPriorityManager.gonk.BACKGROUND.Nice", 18);
|
||||
|
||||
// Processes get this niceness when they have low CPU priority.
|
||||
pref("hal.processPriorityManager.gonk.LowCPUNice", 18);
|
||||
|
||||
// Fire a memory pressure event when the system has less than Xmb of memory
|
||||
// remaining. You should probably set this just above Y.KillUnderMB for
|
||||
// remaining. You should probably set this just above Y.KillUnderKB for
|
||||
// the highest priority class Y that you want to make an effort to keep alive.
|
||||
// (For example, we want BACKGROUND_PERCEIVABLE to stay alive.) If you set
|
||||
// this too high, then we'll send out a memory pressure event every Z seconds
|
||||
// (see below), even while we have processes that we would happily kill in
|
||||
// order to free up memory.
|
||||
pref("hal.processPriorityManager.gonk.notifyLowMemUnderMB", 14);
|
||||
pref("hal.processPriorityManager.gonk.notifyLowMemUnderKB", 14336);
|
||||
|
||||
// We wait this long before polling the memory-pressure fd after seeing one
|
||||
// memory pressure event. (When we're not under memory pressure, we sit
|
||||
|
@ -1228,7 +1228,7 @@ EnsureKernelLowMemKillerParamsSet()
|
||||
nsAutoCString minfreeParams;
|
||||
|
||||
int32_t lowerBoundOfNextOomScoreAdj = OOM_SCORE_ADJ_MIN - 1;
|
||||
int32_t lowerBoundOfNextKillUnderMB = 0;
|
||||
int32_t lowerBoundOfNextKillUnderKB = 0;
|
||||
int32_t countOfLowmemorykillerParametersSets = 0;
|
||||
|
||||
for (int i = NUM_PROCESS_PRIORITY - 1; i >= 0; i--) {
|
||||
@ -1245,18 +1245,18 @@ EnsureKernelLowMemKillerParamsSet()
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
int32_t killUnderMB;
|
||||
int32_t killUnderKB;
|
||||
if (!NS_SUCCEEDED(Preferences::GetInt(
|
||||
nsPrintfCString("hal.processPriorityManager.gonk.%s.KillUnderMB",
|
||||
nsPrintfCString("hal.processPriorityManager.gonk.%s.KillUnderKB",
|
||||
ProcessPriorityToString(priority)).get(),
|
||||
&killUnderMB))) {
|
||||
&killUnderKB))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// The LMK in kernel silently malfunctions if we assign the parameters
|
||||
// in non-increasing order, so we add this assertion here. See bug 887192.
|
||||
MOZ_ASSERT(oomScoreAdj > lowerBoundOfNextOomScoreAdj);
|
||||
MOZ_ASSERT(killUnderMB > lowerBoundOfNextKillUnderMB);
|
||||
MOZ_ASSERT(killUnderKB > lowerBoundOfNextKillUnderKB);
|
||||
|
||||
// The LMK in kernel only accept 6 sets of LMK parameters. See bug 914728.
|
||||
MOZ_ASSERT(countOfLowmemorykillerParametersSets < 6);
|
||||
@ -1265,10 +1265,10 @@ EnsureKernelLowMemKillerParamsSet()
|
||||
adjParams.AppendPrintf("%d,", OomAdjOfOomScoreAdj(oomScoreAdj));
|
||||
|
||||
// minfree is in pages.
|
||||
minfreeParams.AppendPrintf("%d,", killUnderMB * 1024 * 1024 / PAGE_SIZE);
|
||||
minfreeParams.AppendPrintf("%d,", killUnderKB * 1024 / PAGE_SIZE);
|
||||
|
||||
lowerBoundOfNextOomScoreAdj = oomScoreAdj;
|
||||
lowerBoundOfNextKillUnderMB = killUnderMB;
|
||||
lowerBoundOfNextKillUnderKB = killUnderKB;
|
||||
countOfLowmemorykillerParametersSets++;
|
||||
}
|
||||
|
||||
@ -1281,14 +1281,14 @@ EnsureKernelLowMemKillerParamsSet()
|
||||
}
|
||||
|
||||
// Set the low-memory-notification threshold.
|
||||
int32_t lowMemNotifyThresholdMB;
|
||||
int32_t lowMemNotifyThresholdKB;
|
||||
if (NS_SUCCEEDED(Preferences::GetInt(
|
||||
"hal.processPriorityManager.gonk.notifyLowMemUnderMB",
|
||||
&lowMemNotifyThresholdMB))) {
|
||||
"hal.processPriorityManager.gonk.notifyLowMemUnderKB",
|
||||
&lowMemNotifyThresholdKB))) {
|
||||
|
||||
// notify_trigger is in pages.
|
||||
WriteToFile("/sys/module/lowmemorykiller/parameters/notify_trigger",
|
||||
nsPrintfCString("%d", lowMemNotifyThresholdMB * 1024 * 1024 / PAGE_SIZE).get());
|
||||
nsPrintfCString("%d", lowMemNotifyThresholdKB * 1024 / PAGE_SIZE).get());
|
||||
}
|
||||
|
||||
// Ensure OOM events appear in logcat
|
||||
|
Loading…
Reference in New Issue
Block a user