From 5841cc213d7db9409430bb9ce21c1c32756e72da Mon Sep 17 00:00:00 2001 From: Choonghoon Park Date: Thu, 1 Apr 2021 13:59:15 +0900 Subject: [PATCH] ANDROID: GKI: sched: add rvh for new cfs task util A vendor hook is added in post_init_entity_util_avg before a new cfs task's util is attached to cfs_rq's util so that vendors can gather and modify se's information to modify scheduling behavior and DVFS as they want. trace_android_rvh_new_task_stats is not a proper hook because it is called after the task's util is attached to cfs_rq's util, which means updating cfs_rq's sched_avg and DVFS request are done. Bug: 184219858 Signed-off-by: Choonghoon Park Change-Id: I2deaa93297f8464895978496c9838cdffaa35b7f --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/sched.h | 4 ++++ kernel/sched/fair.c | 2 ++ 3 files changed, 7 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index f3af14c5a0f1..b2b3dae4cb9a 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -227,3 +227,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_alloc_new_buf_locked); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_reply); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_trans); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_preset); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_post_init_entity_util_avg); diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index 74aa0de55465..f38d77103776 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -285,6 +285,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_util_est_update, DECLARE_HOOK(android_vh_account_task_time, TP_PROTO(struct task_struct *p, struct rq *rq, int user_tick), TP_ARGS(p, rq, user_tick)); + +DECLARE_RESTRICTED_HOOK(android_rvh_post_init_entity_util_avg, + TP_PROTO(struct sched_entity *se), + TP_ARGS(se), 1); /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_SCHED_H */ diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 5268007d1ae1..72a065c74550 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -824,6 +824,8 @@ void post_init_entity_util_avg(struct task_struct *p) return; } + /* Hook before this se's util is attached to cfs_rq's util */ + trace_android_rvh_post_init_entity_util_avg(se); attach_entity_cfs_rq(se); }