ANDROID: Sched: Add hooks for scheduler
Add vendors hooks for to facilitate various scheduler value adds. Bug: 176077958 Change-Id: I5d488ae78ce05f81e6c73b69c56128b065647fec Signed-off-by: Shaleen Agrawal <shalagra@codeaurora.org>
This commit is contained in:

committed by
Todd Kjos

parent
0b24bdb73c
commit
1feedbd763
@@ -116,3 +116,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_cpu_capacity);
|
|||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_misfit_status);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_misfit_status);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpu_cgroup_attach);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpu_cgroup_attach);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpu_cgroup_can_attach);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpu_cgroup_can_attach);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_fork_init);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_ttwu_cond);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_schedule_bug);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_exec);
|
||||||
|
@@ -202,6 +202,22 @@ DECLARE_RESTRICTED_HOOK(android_rvh_cpu_cgroup_attach,
|
|||||||
DECLARE_RESTRICTED_HOOK(android_rvh_cpu_cgroup_can_attach,
|
DECLARE_RESTRICTED_HOOK(android_rvh_cpu_cgroup_can_attach,
|
||||||
TP_PROTO(struct cgroup_taskset *tset, int *retval),
|
TP_PROTO(struct cgroup_taskset *tset, int *retval),
|
||||||
TP_ARGS(tset, retval), 1);
|
TP_ARGS(tset, retval), 1);
|
||||||
|
|
||||||
|
DECLARE_RESTRICTED_HOOK(android_rvh_sched_fork_init,
|
||||||
|
TP_PROTO(struct task_struct *p),
|
||||||
|
TP_ARGS(p), 1);
|
||||||
|
|
||||||
|
DECLARE_RESTRICTED_HOOK(android_rvh_ttwu_cond,
|
||||||
|
TP_PROTO(bool *cond),
|
||||||
|
TP_ARGS(cond), 1);
|
||||||
|
|
||||||
|
DECLARE_RESTRICTED_HOOK(android_rvh_schedule_bug,
|
||||||
|
TP_PROTO(void *unused),
|
||||||
|
TP_ARGS(unused), 1);
|
||||||
|
|
||||||
|
DECLARE_RESTRICTED_HOOK(android_rvh_sched_exec,
|
||||||
|
TP_PROTO(bool *cond),
|
||||||
|
TP_ARGS(cond), 1);
|
||||||
#else
|
#else
|
||||||
#define trace_android_rvh_select_task_rq_fair(p, prev_cpu, sd_flag, wake_flags, new_cpu)
|
#define trace_android_rvh_select_task_rq_fair(p, prev_cpu, sd_flag, wake_flags, new_cpu)
|
||||||
#define trace_android_rvh_select_task_rq_rt(p, prev_cpu, sd_flag, wake_flags, new_cpu)
|
#define trace_android_rvh_select_task_rq_rt(p, prev_cpu, sd_flag, wake_flags, new_cpu)
|
||||||
@@ -248,6 +264,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_cpu_cgroup_can_attach,
|
|||||||
#define trace_android_rvh_update_misfit_status(p, rq, need_update)
|
#define trace_android_rvh_update_misfit_status(p, rq, need_update)
|
||||||
#define trace_android_rvh_cpu_cgroup_attach(tset)
|
#define trace_android_rvh_cpu_cgroup_attach(tset)
|
||||||
#define trace_android_rvh_cpu_cgroup_can_attach(tset, retval)
|
#define trace_android_rvh_cpu_cgroup_can_attach(tset, retval)
|
||||||
|
#define trace_android_rvh_sched_fork_init(p)
|
||||||
|
#define trace_android_rvh_ttwu_cond(cond)
|
||||||
|
#define trace_android_rvh_schedule_bug(unused)
|
||||||
|
#define trace_android_rvh_sched_exec(cond)
|
||||||
#endif
|
#endif
|
||||||
#endif /* _TRACE_HOOK_SCHED_H */
|
#endif /* _TRACE_HOOK_SCHED_H */
|
||||||
/* This part must be outside protection */
|
/* This part must be outside protection */
|
||||||
|
@@ -2704,7 +2704,12 @@ static inline bool ttwu_queue_cond(int cpu, int wake_flags)
|
|||||||
|
|
||||||
static bool ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_flags)
|
static bool ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_flags)
|
||||||
{
|
{
|
||||||
if (sched_feat(TTWU_QUEUE) && ttwu_queue_cond(cpu, wake_flags)) {
|
bool cond = false;
|
||||||
|
|
||||||
|
trace_android_rvh_ttwu_cond(&cond);
|
||||||
|
|
||||||
|
if ((sched_feat(TTWU_QUEUE) && ttwu_queue_cond(cpu, wake_flags)) ||
|
||||||
|
cond) {
|
||||||
if (WARN_ON_ONCE(cpu == smp_processor_id()))
|
if (WARN_ON_ONCE(cpu == smp_processor_id()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -3118,6 +3123,8 @@ static void __sched_fork(unsigned long clone_flags, struct task_struct *p)
|
|||||||
p->se.cfs_rq = NULL;
|
p->se.cfs_rq = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
trace_android_rvh_sched_fork_init(p);
|
||||||
|
|
||||||
#ifdef CONFIG_SCHEDSTATS
|
#ifdef CONFIG_SCHEDSTATS
|
||||||
/* Even if schedstat is disabled, there should not be garbage */
|
/* Even if schedstat is disabled, there should not be garbage */
|
||||||
memset(&p->se.statistics, 0, sizeof(p->se.statistics));
|
memset(&p->se.statistics, 0, sizeof(p->se.statistics));
|
||||||
@@ -3940,6 +3947,11 @@ void sched_exec(void)
|
|||||||
struct task_struct *p = current;
|
struct task_struct *p = current;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int dest_cpu;
|
int dest_cpu;
|
||||||
|
bool cond = false;
|
||||||
|
|
||||||
|
trace_android_rvh_sched_exec(&cond);
|
||||||
|
if (cond)
|
||||||
|
return;
|
||||||
|
|
||||||
raw_spin_lock_irqsave(&p->pi_lock, flags);
|
raw_spin_lock_irqsave(&p->pi_lock, flags);
|
||||||
dest_cpu = p->sched_class->select_task_rq(p, task_cpu(p), SD_BALANCE_EXEC, 0);
|
dest_cpu = p->sched_class->select_task_rq(p, task_cpu(p), SD_BALANCE_EXEC, 0);
|
||||||
@@ -4317,6 +4329,8 @@ static noinline void __schedule_bug(struct task_struct *prev)
|
|||||||
if (panic_on_warn)
|
if (panic_on_warn)
|
||||||
panic("scheduling while atomic\n");
|
panic("scheduling while atomic\n");
|
||||||
|
|
||||||
|
trace_android_rvh_schedule_bug(NULL);
|
||||||
|
|
||||||
dump_stack();
|
dump_stack();
|
||||||
add_taint(TAINT_WARN, LOCKDEP_STILL_OK);
|
add_taint(TAINT_WARN, LOCKDEP_STILL_OK);
|
||||||
}
|
}
|
||||||
@@ -7177,6 +7191,7 @@ void __init sched_init_smp(void)
|
|||||||
/* Move init over to a non-isolated CPU */
|
/* Move init over to a non-isolated CPU */
|
||||||
if (set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_FLAG_DOMAIN)) < 0)
|
if (set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_FLAG_DOMAIN)) < 0)
|
||||||
BUG();
|
BUG();
|
||||||
|
|
||||||
sched_init_granularity();
|
sched_init_granularity();
|
||||||
|
|
||||||
init_sched_rt_class();
|
init_sched_rt_class();
|
||||||
@@ -7464,6 +7479,9 @@ void ___might_sleep(const char *file, int line, int preempt_offset)
|
|||||||
pr_err("Preemption disabled at:");
|
pr_err("Preemption disabled at:");
|
||||||
print_ip_sym(KERN_ERR, preempt_disable_ip);
|
print_ip_sym(KERN_ERR, preempt_disable_ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trace_android_rvh_schedule_bug(NULL);
|
||||||
|
|
||||||
dump_stack();
|
dump_stack();
|
||||||
add_taint(TAINT_WARN, LOCKDEP_STILL_OK);
|
add_taint(TAINT_WARN, LOCKDEP_STILL_OK);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user