From 1eea1cbdd3da9c8c73320d015db0e1f342e6bcac 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 fab0e3d6d0de..1ff06143076b 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -188,3 +188,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_selinux_is_initialized); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_mmap_file); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_file_open); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_bpf_syscall); +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 9f3ad757b444..202479c9767b 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -306,6 +306,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_dequeue_task_fair, TP_PROTO(struct rq *rq, struct task_struct *p, int flags), TP_ARGS(rq, p, flags), 1); +DECLARE_RESTRICTED_HOOK(android_rvh_post_init_entity_util_avg, + TP_PROTO(struct sched_entity *se), + TP_ARGS(se), 1); + #endif /* _TRACE_HOOK_SCHED_H */ /* This part must be outside protection */ #include diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0dfe1435896b..fc5273227808 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -828,6 +828,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); }