lmkd: migrate process to FOREGROUND sched group before kill am: 0195bcdba7
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1825954 Change-Id: I9b572a9786cf5b7a583730654facca0e30bf57bb
This commit is contained in:
commit
a95efc0941
12
lmkd.cpp
12
lmkd.cpp
|
|
@ -40,7 +40,6 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include <cutils/properties.h>
|
||||
#include <cutils/sched_policy.h>
|
||||
#include <cutils/sockets.h>
|
||||
#include <liblmkd_utils.h>
|
||||
#include <lmkd.h>
|
||||
|
|
@ -48,6 +47,7 @@
|
|||
#include <log/log_event_list.h>
|
||||
#include <log/log_time.h>
|
||||
#include <private/android_filesystem_config.h>
|
||||
#include <processgroup/processgroup.h>
|
||||
#include <psi/psi.h>
|
||||
#include <system/thread_defs.h>
|
||||
|
||||
|
|
@ -2008,7 +2008,8 @@ static struct proc *proc_get_heaviest(int oomadj) {
|
|||
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;
|
||||
char proc_path[PATH_MAX];
|
||||
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);
|
||||
}
|
||||
|
||||
if (set_cpuset_policy(t_pid, sp)) {
|
||||
ALOGW("Failed to set_cpuset_policy on pid(%d) t_pid(%d) to %d", pid, t_pid, (int)sp);
|
||||
if (!SetTaskProfiles(t_pid, profiles)) {
|
||||
ALOGW("Failed to set task_profiles on pid(%d) t_pid(%d)", pid, t_pid);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -2207,7 +2208,8 @@ static int kill_one_process(struct proc* procp, int min_oom_score, struct kill_i
|
|||
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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue