ANDROID: vendor_hooks: Add hooks for scheduler
Add hooks to support oem's scheduler feature. Bug: 182441701 Signed-off-by: xieliujie <xieliujie@oppo.com> Change-Id: I31023844b20923bed1ca216831e7a2431e9ab0c9
This commit is contained in:
parent
7e2c33ac0e
commit
53e8099784
@ -181,6 +181,10 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_uclamp_eff_get);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpufreq_transition);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cgroup_set_task);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_syscall_prctl_finished);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_check_preempt_tick);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_check_preempt_wakeup_ignore);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_replace_next_task_fair);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_build_sched_domains);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_mutex_list_add);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_unlock_slowpath);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_wake_finish);
|
||||
|
@ -1358,7 +1358,7 @@ struct task_struct {
|
||||
struct callback_head mce_kill_me;
|
||||
#endif
|
||||
ANDROID_VENDOR_DATA_ARRAY(1, 64);
|
||||
ANDROID_OEM_DATA_ARRAY(1, 2);
|
||||
ANDROID_OEM_DATA_ARRAY(1, 6);
|
||||
|
||||
/*
|
||||
* New fields for task_struct should be added above here, so that
|
||||
|
@ -190,8 +190,8 @@ DECLARE_RESTRICTED_HOOK(android_rvh_account_irq,
|
||||
|
||||
struct sched_entity;
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_place_entity,
|
||||
TP_PROTO(struct sched_entity *se, u64 *vruntime),
|
||||
TP_ARGS(se, vruntime), 1);
|
||||
TP_PROTO(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial, u64 vruntime),
|
||||
TP_ARGS(cfs_rq, se, initial, vruntime), 1);
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_build_perf_domains,
|
||||
TP_PROTO(bool *eas_check),
|
||||
@ -275,6 +275,19 @@ DECLARE_RESTRICTED_HOOK(android_rvh_uclamp_eff_get,
|
||||
struct uclamp_se *uclamp_max, struct uclamp_se *uclamp_eff, int *ret),
|
||||
TP_ARGS(p, clamp_id, uclamp_max, uclamp_eff, ret), 1);
|
||||
|
||||
DECLARE_HOOK(android_vh_build_sched_domains,
|
||||
TP_PROTO(bool has_asym),
|
||||
TP_ARGS(has_asym));
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_check_preempt_tick,
|
||||
TP_PROTO(struct task_struct *p, unsigned long *ideal_runtime, bool *skip_preempt),
|
||||
TP_ARGS(p, ideal_runtime, skip_preempt), 1);
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_check_preempt_wakeup_ignore,
|
||||
TP_PROTO(struct task_struct *p, bool *ignore),
|
||||
TP_ARGS(p, ignore), 1);
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_replace_next_task_fair,
|
||||
TP_PROTO(struct rq *rq, struct task_struct **p, struct sched_entity **se, bool *repick, bool simple),
|
||||
TP_ARGS(rq, p, se, repick, simple), 1);
|
||||
|
||||
/* macro versions of hooks are no longer required */
|
||||
|
||||
#endif /* _TRACE_HOOK_SCHED_H */
|
||||
|
@ -4148,11 +4148,11 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
|
||||
thresh >>= 1;
|
||||
|
||||
vruntime -= thresh;
|
||||
trace_android_rvh_place_entity(se, &vruntime);
|
||||
}
|
||||
|
||||
/* ensure we never gain time by being placed backwards. */
|
||||
se->vruntime = max_vruntime(se->vruntime, vruntime);
|
||||
trace_android_rvh_place_entity(cfs_rq, se, initial, vruntime);
|
||||
}
|
||||
|
||||
static void check_enqueue_throttle(struct cfs_rq *cfs_rq);
|
||||
@ -4376,9 +4376,13 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr)
|
||||
unsigned long ideal_runtime, delta_exec;
|
||||
struct sched_entity *se;
|
||||
s64 delta;
|
||||
bool skip_preempt = false;
|
||||
|
||||
ideal_runtime = sched_slice(cfs_rq, curr);
|
||||
delta_exec = curr->sum_exec_runtime - curr->prev_sum_exec_runtime;
|
||||
trace_android_rvh_check_preempt_tick(current, &ideal_runtime, &skip_preempt);
|
||||
if (skip_preempt)
|
||||
return;
|
||||
if (delta_exec > ideal_runtime) {
|
||||
resched_curr(rq_of(cfs_rq));
|
||||
/*
|
||||
@ -7018,9 +7022,13 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
|
||||
int scale = cfs_rq->nr_running >= sched_nr_latency;
|
||||
int next_buddy_marked = 0;
|
||||
bool preempt = false;
|
||||
bool ignore = false;
|
||||
|
||||
if (unlikely(se == pse))
|
||||
return;
|
||||
trace_android_rvh_check_preempt_wakeup_ignore(curr, &ignore);
|
||||
if (ignore)
|
||||
return;
|
||||
|
||||
/*
|
||||
* This is possible from callers such as attach_tasks(), in which we
|
||||
@ -7104,6 +7112,7 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf
|
||||
struct sched_entity *se;
|
||||
struct task_struct *p;
|
||||
int new_tasks;
|
||||
bool repick = false;
|
||||
|
||||
again:
|
||||
if (!sched_fair_runnable(rq))
|
||||
@ -7157,6 +7166,7 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf
|
||||
} while (cfs_rq);
|
||||
|
||||
p = task_of(se);
|
||||
trace_android_rvh_replace_next_task_fair(rq, &p, &se, &repick, false);
|
||||
|
||||
/*
|
||||
* Since we haven't yet done put_prev_entity and if the selected task
|
||||
@ -7190,6 +7200,10 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf
|
||||
if (prev)
|
||||
put_prev_task(rq, prev);
|
||||
|
||||
trace_android_rvh_replace_next_task_fair(rq, &p, &se, &repick, true);
|
||||
if (repick)
|
||||
goto done;
|
||||
|
||||
do {
|
||||
se = pick_next_entity(cfs_rq, NULL);
|
||||
set_next_entity(cfs_rq, se);
|
||||
|
@ -2063,6 +2063,7 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
|
||||
pr_info("root domain span: %*pbl (max cpu_capacity = %lu)\n",
|
||||
cpumask_pr_args(cpu_map), rq->rd->max_cpu_capacity);
|
||||
}
|
||||
trace_android_vh_build_sched_domains(has_asym);
|
||||
|
||||
ret = 0;
|
||||
error:
|
||||
|
Loading…
Reference in New Issue
Block a user