From f7ede2b168eae07969bfb8b9167ddc205d6651b9 Mon Sep 17 00:00:00 2001 From: Pavankumar Kondeti Date: Tue, 6 Apr 2021 06:34:36 +0530 Subject: [PATCH] ANDROID: sched: Update android_rvh_check_preempt_wakeup hook android_rvh_check_preempt_wakeup hook is in place to allow vendor modules to force the running task preemption by the waking task. Update the tracepoint to accept another input to not preempting the current running task. The hook is moved further down so that it can be updated to pass the sched_entity structure corresponding to waking and running tasks in the next patch. Bug: 184575210 Change-Id: Id4f45ba2819802636b6b86ed34c124771d0d69eb Signed-off-by: Pavankumar Kondeti Signed-off-by: Shaleen Agrawal --- include/trace/hooks/sched.h | 4 ++-- kernel/sched/fair.c | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index 43e14c5cd4da..e1090b532a46 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -255,8 +255,8 @@ DECLARE_RESTRICTED_HOOK(android_rvh_pick_next_entity, TP_ARGS(cfs_rq, curr, se), 1); DECLARE_RESTRICTED_HOOK(android_rvh_check_preempt_wakeup, - TP_PROTO(struct rq *rq, struct task_struct *p, bool *preempt), - TP_ARGS(rq, p, preempt), 1); + TP_PROTO(struct rq *rq, struct task_struct *p, bool *preempt, bool *nopreempt), + TP_ARGS(rq, p, preempt, nopreempt), 1); #endif /* _TRACE_HOOK_SCHED_H */ /* This part must be outside protection */ diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c95486b7a335..255ab88319dc 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7265,9 +7265,6 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_ if (unlikely(p->policy != SCHED_NORMAL) || !sched_feat(WAKEUP_PREEMPTION)) return; - trace_android_rvh_check_preempt_wakeup(rq, p, &preempt); - if (preempt) - goto preempt; find_matching_se(&se, &pse); BUG_ON(!pse); @@ -7284,6 +7281,12 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_ return; update_curr(cfs_rq_of(se)); + trace_android_rvh_check_preempt_wakeup(rq, p, &preempt, &ignore); + if (preempt) + goto preempt; + if (ignore) + return; + if (wakeup_preempt_entity(se, pse) == 1) { /* * Bias pick_next to pick the sched entity that is