diff options
author | Joel Fernandes <joelaf@google.com> | 2017-06-21 18:15:46 -0700 |
---|---|---|
committer | Thierry Strudel <tstrudel@google.com> | 2017-06-23 12:00:05 -0700 |
commit | 06de20685970998a91fe50e3d4a7e1d6a66a6688 (patch) | |
tree | 03e750715bb15c8c8262f279476c5fdccb2b171e | |
parent | e02f1d718a967adaebc9098f6207e529a50a253b (diff) | |
download | msm-android-msm-marlin-3.18-o-preview-4.tar.gz |
sched: rt: Avoid CPUs running top apps if possibleandroid-o-preview-4_r0.6android-8.0.0_r0.4android-msm-marlin-3.18-oreo-r6android-msm-marlin-3.18-o-preview-4
If an RT task was running on a CPU some time back and a top-app happen
to be running later, then when the RT task wakes up, we will blindly
wake up the RT task on its previous CPU thus preventing the top-app from
running until the RT task sleeps. RT tasks can run on any available CPU
that's lower in priority than itself so we should look at all possible
options under this condition. Incase no option is available, it will
fallback to preempting the top-app as before.
Tests:
* Improvement in UiBench GLTextureView seen which gets us to the N levels.
Other benchmarks show good or better performance.
* No energy increases seen with UiBench GLTextureView and Camera preview.
bug: 62806392
Change-Id: Ifea9157c23decc34f64ce8ab87df8ac4d1bcb3c3
Signed-off-by: Joel Fernandes <joelaf@google.com>
-rw-r--r-- | kernel/sched/rt.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 4d25a1f400f0..d1c0952eb22a 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -1488,6 +1488,20 @@ static bool softirq_masked(int pc) return !!((pc & SOFTIRQ_MASK)>= SOFTIRQ_DISABLE_OFFSET); } +static bool is_top_app_cpu(int cpu) +{ + bool boosted = (schedtune_cpu_boost(cpu) > 0); + + return boosted; +} + +static bool is_top_app(struct task_struct *cur) +{ + bool boosted = (schedtune_task_boost(cur) > 0); + + return boosted; +} + /* * Return whether the task on the given cpu is currently non-preemptible * while handling a potentially long softint, or if the task is likely @@ -1502,8 +1516,14 @@ task_may_not_preempt(struct task_struct *task, int cpu) struct task_struct *cpu_ksoftirqd = per_cpu(ksoftirqd, cpu); int task_pc = 0; - if (task) + if (task) { + if (is_top_app(task)) + return true; task_pc = task_preempt_count(task); + } + + if (is_top_app_cpu(cpu)) + return true; if (softirq_masked(task_pc)) return true; |