Skip to content

Commit

Permalink
Revert "proc: Don't let Google Camera run in the background"
Browse files Browse the repository at this point in the history
I won't modify the code and include every gcam package naming.

This reverts commit 092fafb.
  • Loading branch information
penglezos committed Apr 8, 2020
1 parent c7c241b commit a03a172
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,6 @@

#include "../../lib/kstrtox.h"

struct task_kill_info {
struct task_struct *task;
struct work_struct work;
};

static void proc_kill_task(struct work_struct *work)
{
struct task_kill_info *kinfo = container_of(work, typeof(*kinfo), work);
struct task_struct *task = kinfo->task;

send_sig(SIGKILL, task, 0);
put_task_struct(task);
kfree(kinfo);
}

/* NOTE:
* Implementing inode permission operations in /proc is almost
* certainly an error. Permission checks need to happen during
Expand Down Expand Up @@ -1022,7 +1007,6 @@ static int __set_oom_adj(struct file *file, int oom_adj, bool legacy)
static DEFINE_MUTEX(oom_adj_mutex);
struct mm_struct *mm = NULL;
struct task_struct *task;
char task_comm[TASK_COMM_LEN];
int err = 0;

task = get_proc_task(file_inode(file));
Expand Down Expand Up @@ -1072,8 +1056,6 @@ static int __set_oom_adj(struct file *file, int oom_adj, bool legacy)
if (!legacy && has_capability_noaudit(current, CAP_SYS_RESOURCE))
task->signal->oom_score_adj_min = (short)oom_adj;
trace_oom_score_adj_update(task);
if (oom_adj >= 700)
strncpy(task_comm, task->comm, TASK_COMM_LEN);

if (mm) {
struct task_struct *p;
Expand Down Expand Up @@ -1101,20 +1083,6 @@ static int __set_oom_adj(struct file *file, int oom_adj, bool legacy)
err_unlock:
mutex_unlock(&oom_adj_mutex);
put_task_struct(task);
/* These apps burn through CPU in the background. Don't let them. */
if (!err && oom_adj >= 700) {
if (!strcmp(task_comm, "id.GoogleCamera")) {
struct task_kill_info *kinfo;

kinfo = kmalloc(sizeof(*kinfo), GFP_KERNEL);
if (kinfo) {
get_task_struct(task);
kinfo->task = task;
INIT_WORK(&kinfo->work, proc_kill_task);
schedule_work(&kinfo->work);
}
}
}
return err;
}

Expand Down

0 comments on commit a03a172

Please sign in to comment.