lmkd: migrate process to FOREGROUND sched group before kill am: 0195bcdba7 am: a95efc0941 am: 50bf1dc40c
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1825954 Change-Id: I73a62f67750c64f87739d64ea0ba3f9010b94f70
This commit is contained in:
commit
193b84cd38
12
lmkd.cpp
12
lmkd.cpp
|
|
@ -40,7 +40,6 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <cutils/properties.h>
|
#include <cutils/properties.h>
|
||||||
#include <cutils/sched_policy.h>
|
|
||||||
#include <cutils/sockets.h>
|
#include <cutils/sockets.h>
|
||||||
#include <liblmkd_utils.h>
|
#include <liblmkd_utils.h>
|
||||||
#include <lmkd.h>
|
#include <lmkd.h>
|
||||||
|
|
@ -48,6 +47,7 @@
|
||||||
#include <log/log_event_list.h>
|
#include <log/log_event_list.h>
|
||||||
#include <log/log_time.h>
|
#include <log/log_time.h>
|
||||||
#include <private/android_filesystem_config.h>
|
#include <private/android_filesystem_config.h>
|
||||||
|
#include <processgroup/processgroup.h>
|
||||||
#include <psi/psi.h>
|
#include <psi/psi.h>
|
||||||
#include <system/thread_defs.h>
|
#include <system/thread_defs.h>
|
||||||
|
|
||||||
|
|
@ -2008,7 +2008,8 @@ static struct proc *proc_get_heaviest(int oomadj) {
|
||||||
return maxprocp;
|
return maxprocp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_process_group_and_prio(int pid, SchedPolicy sp, int prio) {
|
static void set_process_group_and_prio(int pid, const std::vector<std::string>& profiles,
|
||||||
|
int prio) {
|
||||||
DIR* d;
|
DIR* d;
|
||||||
char proc_path[PATH_MAX];
|
char proc_path[PATH_MAX];
|
||||||
struct dirent* de;
|
struct dirent* de;
|
||||||
|
|
@ -2035,8 +2036,8 @@ static void set_process_group_and_prio(int pid, SchedPolicy sp, int prio) {
|
||||||
ALOGW("Unable to raise priority of killing t_pid (%d): errno=%d", t_pid, errno);
|
ALOGW("Unable to raise priority of killing t_pid (%d): errno=%d", t_pid, errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (set_cpuset_policy(t_pid, sp)) {
|
if (!SetTaskProfiles(t_pid, profiles)) {
|
||||||
ALOGW("Failed to set_cpuset_policy on pid(%d) t_pid(%d) to %d", pid, t_pid, (int)sp);
|
ALOGW("Failed to set task_profiles on pid(%d) t_pid(%d)", pid, t_pid);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2207,7 +2208,8 @@ static int kill_one_process(struct proc* procp, int min_oom_score, struct kill_i
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_process_group_and_prio(pid, SP_FOREGROUND, ANDROID_PRIORITY_HIGHEST);
|
set_process_group_and_prio(pid, {"CPUSET_SP_BACKGROUND", "SCHED_SP_FOREGROUND"},
|
||||||
|
ANDROID_PRIORITY_HIGHEST);
|
||||||
|
|
||||||
last_kill_tm = *tm;
|
last_kill_tm = *tm;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue