lmkd: migrate process to FOREGROUND sched group before kill
BG group may have settings such as cpu.shares impacting reclaim
performance. Let us migrate task to foreground sched group similarly to
cpuset group.
Test: Build
Bug: 199797672
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I75ee9f3486a2c76e65267a98e39edff96a5e1673
(cherry picked from commit 0195bcdba7)
This commit is contained in:
parent
fcb9cb6de4
commit
90f3c9e5c6
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>
|
||||
|
||||
|
|
@ -1987,7 +1987,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;
|
||||
|
|
@ -2014,8 +2015,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;
|
||||
}
|
||||
}
|
||||
|
|
@ -2190,7 +2191,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