Revert "lmkd: set priority of the kill target from the reaper thread"
This reverts commit 208d1af144.
Reason for revert: Seems to cause a test breakage at b/254880957
Change-Id: Icf497abf3e35ffe632a11629c8a067581269b035
This commit is contained in:
parent
208d1af144
commit
c5e4185a02
47
reaper.cpp
47
reaper.cpp
|
|
@ -53,41 +53,6 @@ static inline long get_time_diff_ms(struct timespec *from,
|
||||||
(to->tv_nsec - from->tv_nsec) / (long)NS_PER_MS;
|
(to->tv_nsec - from->tv_nsec) / (long)NS_PER_MS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_process_group_and_prio(uid_t uid, int pid, const std::vector<std::string>& profiles,
|
|
||||||
int prio) {
|
|
||||||
DIR* d;
|
|
||||||
char proc_path[PATH_MAX];
|
|
||||||
struct dirent* de;
|
|
||||||
|
|
||||||
if (!SetProcessProfilesCached(uid, pid, profiles)) {
|
|
||||||
ALOGW("Failed to set task profiles for the process (%d) being killed", pid);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(proc_path, sizeof(proc_path), "/proc/%d/task", pid);
|
|
||||||
if (!(d = opendir(proc_path))) {
|
|
||||||
ALOGW("Failed to open %s; errno=%d: process pid(%d) might have died", proc_path, errno,
|
|
||||||
pid);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((de = readdir(d))) {
|
|
||||||
int t_pid;
|
|
||||||
|
|
||||||
if (de->d_name[0] == '.') continue;
|
|
||||||
t_pid = atoi(de->d_name);
|
|
||||||
|
|
||||||
if (!t_pid) {
|
|
||||||
ALOGW("Failed to get t_pid for '%s' of pid(%d)", de->d_name, pid);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (setpriority(PRIO_PROCESS, t_pid, prio) && errno != ESRCH) {
|
|
||||||
ALOGW("Unable to raise priority of killing t_pid (%d): errno=%d", t_pid, errno);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closedir(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void* reaper_main(void* param) {
|
static void* reaper_main(void* param) {
|
||||||
Reaper *reaper = static_cast<Reaper*>(param);
|
Reaper *reaper = static_cast<Reaper*>(param);
|
||||||
struct timespec start_tm, end_tm;
|
struct timespec start_tm, end_tm;
|
||||||
|
|
@ -115,11 +80,6 @@ static void* reaper_main(void* param) {
|
||||||
reaper->notify_kill_failure(target.pid);
|
reaper->notify_kill_failure(target.pid);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_process_group_and_prio(target.uid, target.pid,
|
|
||||||
{"CPUSET_SP_FOREGROUND", "SCHED_SP_FOREGROUND"},
|
|
||||||
ANDROID_PRIORITY_NORMAL);
|
|
||||||
|
|
||||||
if (process_mrelease(target.pidfd, 0)) {
|
if (process_mrelease(target.pidfd, 0)) {
|
||||||
ALOGE("process_mrelease %d failed: %s", target.pidfd, strerror(errno));
|
ALOGE("process_mrelease %d failed: %s", target.pidfd, strerror(errno));
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -130,6 +90,13 @@ static void* reaper_main(void* param) {
|
||||||
get_time_diff_ms(&start_tm, &end_tm));
|
get_time_diff_ms(&start_tm, &end_tm));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!SetProcessProfilesCached(target.uid, target.pid,
|
||||||
|
{"CPUSET_SP_FOREGROUND", "SCHED_SP_FOREGROUND"})) {
|
||||||
|
if (reaper->debug_enabled()) {
|
||||||
|
ALOGW("Failed to set task profiles for the process (%d) being killed", target.pid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
close(target.pidfd);
|
close(target.pidfd);
|
||||||
reaper->request_complete();
|
reaper->request_complete();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue