cgroup: Boost whenever a zygote-forked process becomes a top app

Boost to the max for 1000 ms whenever the top app changes, which
improves app launch speeds and addresses jitter when switching between
apps. A check to make sure that the top-app's parent is zygote ensures
that a user-facing app is indeed what's added to the top app task group,
since app processes are forked from zygote.

Change-Id: I49563d8baef7cefa195c919acf97343fa424c3be
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Sultan Alsawaf 2019-03-13 22:41:46 -07:00 committed by Richard Raya
parent f49f0241d2
commit 5626e9eb9c

View File

@ -13,6 +13,9 @@
#include <linux/delayacct.h>
#include <linux/pid_namespace.h>
#include <linux/cgroupstats.h>
#include <linux/binfmts.h>
#include <linux/cpu_input_boost.h>
#include <linux/devfreq_boost.h>
#include <trace/events/cgroup.h>
@ -540,6 +543,15 @@ 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 transitions. */
if (!ret && !threadgroup &&
!memcmp(of->kn->parent->name, "top-app", sizeof("top-app")) &&
task_is_zygote(task->parent)) {
cpu_input_boost_kick_max(1000);
devfreq_boost_kick_max(DEVFREQ_MSM_CPUBW, 1000);
devfreq_boost_kick_max(DEVFREQ_MSM_LLCCBW, 1000);
}
out_finish:
cgroup_procs_write_finish(task);
out_unlock: