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:
Shaleen Agrawal
2020-12-21 16:29:49 -08:00
committed by Todd Kjos
parent 0b24bdb73c
commit 1feedbd763
3 changed files with 43 additions and 1 deletions

View File

@@ -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)
{
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()))
return false;
@@ -3118,6 +3123,8 @@ static void __sched_fork(unsigned long clone_flags, struct task_struct *p)
p->se.cfs_rq = NULL;
#endif
trace_android_rvh_sched_fork_init(p);
#ifdef CONFIG_SCHEDSTATS
/* Even if schedstat is disabled, there should not be garbage */
memset(&p->se.statistics, 0, sizeof(p->se.statistics));
@@ -3940,6 +3947,11 @@ void sched_exec(void)
struct task_struct *p = current;
unsigned long flags;
int dest_cpu;
bool cond = false;
trace_android_rvh_sched_exec(&cond);
if (cond)
return;
raw_spin_lock_irqsave(&p->pi_lock, flags);
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)
panic("scheduling while atomic\n");
trace_android_rvh_schedule_bug(NULL);
dump_stack();
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 */
if (set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_FLAG_DOMAIN)) < 0)
BUG();
sched_init_granularity();
init_sched_rt_class();
@@ -7464,6 +7479,9 @@ void ___might_sleep(const char *file, int line, int preempt_offset)
pr_err("Preemption disabled at:");
print_ip_sym(KERN_ERR, preempt_disable_ip);
}
trace_android_rvh_schedule_bug(NULL);
dump_stack();
add_taint(TAINT_WARN, LOCKDEP_STILL_OK);
}