ANDROID: sched: add hook point in do_sched_yield()

When a task yields, it relinquishes the cpu and
scheduler is tasked to find another task.
However our vendor scheduler logic implementation
could return the same task leading to a loop where
the yielded task gets to run back, so add hook point
in do_sched_yield() for vendor can do some work
before task is scheduled.

Bug: 205804537
Change-Id: I6528c3f4b0ee360559ef9c97cb1eb2b2d1357870
Signed-off-by: Tengfei Fan <quic_tengfan@quicinc.com>
Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
Signed-off-by: Khalid Shaik <khalid.s@samsung.com>
This commit is contained in:
Tengfei Fan
2021-11-22 09:15:36 +08:00
committed by Todd Kjos
parent 2aed2a7cb0
commit 0fabf2342f
3 changed files with 7 additions and 0 deletions

View File

@@ -255,6 +255,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_create_worker);
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_rvh_do_sched_yield);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_wait_for_work);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sync_txn_recvd);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_build_sched_domains);

View File

@@ -291,6 +291,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_cpumask_any_and_distribute,
const struct cpumask *new_mask, int *dest_cpu),
TP_ARGS(p, cpu_valid_mask, new_mask, dest_cpu), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_do_sched_yield,
TP_PROTO(struct rq *rq),
TP_ARGS(rq), 1);
DECLARE_HOOK(android_vh_free_task,
TP_PROTO(struct task_struct *p),
TP_ARGS(p));

View File

@@ -6353,6 +6353,8 @@ static void do_sched_yield(void)
schedstat_inc(rq->yld_count);
current->sched_class->yield_task(rq);
trace_android_rvh_do_sched_yield(rq);
preempt_disable();
rq_unlock_irq(rq, &rf);
sched_preempt_enable_no_resched();