diff --git a/fs/exec.c b/fs/exec.c index 2bd49fbdf38b..3fb5e4bd523e 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -77,6 +77,16 @@ int suid_dumpable = 0; static LIST_HEAD(formats); static DEFINE_RWLOCK(binfmt_lock); +#define ZYGOTE32_BIN "/system/bin/app_process32" +#define ZYGOTE64_BIN "/system/bin/app_process64" +static struct signal_struct *zygote32_sig; +static struct signal_struct *zygote64_sig; + +bool task_is_zygote(struct task_struct *p) +{ + return p->signal == zygote32_sig || p->signal == zygote64_sig; +} + void __register_binfmt(struct linux_binfmt * fmt, int insert) { BUG_ON(!fmt); @@ -1799,6 +1809,13 @@ static int do_execveat_common(int fd, struct filename *filename, if (retval < 0) goto out; + if (is_global_init(current->parent)) { + if (unlikely(!strcmp(filename->name, ZYGOTE32_BIN))) + zygote32_sig = current->signal; + else if (unlikely(!strcmp(filename->name, ZYGOTE64_BIN))) + zygote64_sig = current->signal; + } + /* execve succeeded */ current->fs->in_exec = 0; current->in_execve = 0; diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index ef6f37c7ed39..4e7a46907b6d 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -139,6 +139,7 @@ extern int prepare_bprm_creds(struct linux_binprm *bprm); extern void install_exec_creds(struct linux_binprm *bprm); extern void set_binfmt(struct linux_binfmt *new); extern ssize_t read_code(struct file *, unsigned long, loff_t, size_t); +extern bool task_is_zygote(struct task_struct *p); extern int do_execve(struct filename *, const char __user * const __user *, diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index 7f53d00f19ae..6a3e34f07b36 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include @@ -551,6 +553,11 @@ static ssize_t __cgroup1_procs_write(struct kernfs_open_file *of, ret = cgroup_attach_task(cgrp, task, threadgroup); + /* This covers boosting for app launches and app transitions */ + if (!ret && !threadgroup && !strcmp(of->kn->parent->name, "top-app") && + task_is_zygote(task->parent)) + cpu_input_boost_kick_max(1000); + out_finish: cgroup_procs_write_finish(task); out_unlock: