From a038be9b2c3e68aef7b84570de15fc29326581bb 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 --- include/trace/hooks/sched.h | 4 ++-- kernel/sched/fair.c | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index 20ebd7b22ffc..3230dd761467 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -252,8 +252,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); DECLARE_HOOK(android_vh_do_wake_up_sync, TP_PROTO(struct wait_queue_head *wq_head, int *done), diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 43face3519a9..ab18358ac7e8 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7029,7 +7029,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_ struct cfs_rq *cfs_rq = task_cfs_rq(curr); int scale = cfs_rq->nr_running >= sched_nr_latency; int next_buddy_marked = 0; - bool preempt = false; + bool preempt = false, nopreempt = false; bool ignore = false; if (unlikely(se == pse)) @@ -7077,11 +7077,13 @@ 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); update_curr(cfs_rq_of(se)); + trace_android_rvh_check_preempt_wakeup(rq, p, &preempt, &nopreempt); + if (preempt) + goto preempt; + if (nopreempt) + return; BUG_ON(!pse); if (wakeup_preempt_entity(se, pse) == 1) { /*