ANDROID: sched: Add vendor hooks for override sugov behavior
Upstream moved the sugov to DEADLINE class which has higher prio than RT so it can potentially block many RT use case in Android. Also currently iowait doesn't distinguish background/foreground tasks and we have seen cases where device run to high frequency unnecessarily when running some background I/O. Bug: 344826816 Bug: 297343949 Signed-off-by: Wei Wang <wvw@google.com> Change-Id: I21e9bfe9ef75a4178279574389e417c3f38e65ac (cherry picked from commit e08c5de06edd75e3591ea5ff426b4845cf4076ce) [Trivial conflict in includle/trace/hooks/sched.h due to new code added in same location.] Signed-off-by: Qais Yousef <qyousef@google.com>
This commit is contained in:
committed by
Treehugger Robot
parent
3e15db3d1b
commit
390c2b429d
@@ -498,6 +498,16 @@ DECLARE_RESTRICTED_HOOK(android_rvh_update_rt_rq_load_avg,
|
||||
TP_PROTO(u64 now, struct rq *rq, struct task_struct *tsk, int running),
|
||||
TP_ARGS(now, rq, tsk, running), 1);
|
||||
|
||||
struct sched_attr;
|
||||
|
||||
DECLARE_HOOK(android_vh_set_sugov_sched_attr,
|
||||
TP_PROTO(struct sched_attr *attr),
|
||||
TP_ARGS(attr));
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_set_iowait,
|
||||
TP_PROTO(struct task_struct *p, struct rq *rq, int *should_iowait_boost),
|
||||
TP_ARGS(p, rq, should_iowait_boost), 1);
|
||||
|
||||
/* macro versions of hooks are no longer required */
|
||||
|
||||
#endif /* _TRACE_HOOK_SCHED_H */
|
||||
|
||||
@@ -687,6 +687,7 @@ static int sugov_kthread_create(struct sugov_policy *sg_policy)
|
||||
if (policy->fast_switch_enabled)
|
||||
return 0;
|
||||
|
||||
trace_android_vh_set_sugov_sched_attr(&attr);
|
||||
kthread_init_work(&sg_policy->work, sugov_work);
|
||||
kthread_init_worker(&sg_policy->worker);
|
||||
thread = kthread_create(kthread_worker_fn, &sg_policy->worker,
|
||||
|
||||
@@ -7135,6 +7135,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
|
||||
int task_new = !(flags & ENQUEUE_WAKEUP);
|
||||
int rq_h_nr_running = rq->cfs.h_nr_running;
|
||||
u64 slice = 0;
|
||||
int should_iowait_boost;
|
||||
|
||||
/*
|
||||
* The code below (indirectly) updates schedutil which looks at
|
||||
@@ -7155,7 +7156,9 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
|
||||
* utilization updates, so do it here explicitly with the IOWAIT flag
|
||||
* passed.
|
||||
*/
|
||||
if (p->in_iowait)
|
||||
should_iowait_boost = p->in_iowait;
|
||||
trace_android_rvh_set_iowait(p, rq, &should_iowait_boost);
|
||||
if (should_iowait_boost)
|
||||
cpufreq_update_util(rq, SCHED_CPUFREQ_IOWAIT);
|
||||
|
||||
if (task_new)
|
||||
|
||||
@@ -129,3 +129,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmput);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_prio_inheritance);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_prio_restore);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_rt_rq_load_avg);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_sugov_sched_attr);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_iowait);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user