ANDROID: sched: add vendor hook to set_cpus_allowed

Add new vendor hook when set affinity to detect task status
for performance tuning.

Bug: 236775946
Change-Id: I407637c85e2ea93585877312f090981fee848979
Signed-off-by: Jing-Ting Wu <Jing-Ting.Wu@mediatek.com>
This commit is contained in:
Jing-Ting Wu 2022-06-23 16:10:44 +08:00 committed by Treehugger Robot
parent 241aca3256
commit c4f814c2f3
3 changed files with 7 additions and 0 deletions

View File

@ -272,6 +272,7 @@ 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_set_cpus_allowed_ptr_locked);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_cpus_allowed_by_task);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_rto_next_cpu);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_is_cpu_allowed);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_get_nohz_timer_target);

View File

@ -319,6 +319,11 @@ DECLARE_RESTRICTED_HOOK(android_rvh_set_cpus_allowed_ptr_locked,
unsigned int *dest_cpu),
TP_ARGS(cpu_valid_mask, new_mask, dest_cpu), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_set_cpus_allowed_by_task,
TP_PROTO(const struct cpumask *cpu_valid_mask, const struct cpumask *new_mask,
struct task_struct *p, unsigned int *dest_cpu),
TP_ARGS(cpu_valid_mask, new_mask, p, dest_cpu), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_do_sched_yield,
TP_PROTO(struct rq *rq),
TP_ARGS(rq), 1);

View File

@ -2868,6 +2868,7 @@ static int __set_cpus_allowed_ptr_locked(struct task_struct *p,
*/
dest_cpu = cpumask_any_and_distribute(cpu_valid_mask, new_mask);
trace_android_rvh_set_cpus_allowed_ptr_locked(cpu_valid_mask, new_mask, &dest_cpu);
trace_android_rvh_set_cpus_allowed_by_task(cpu_valid_mask, new_mask, p, &dest_cpu);
if (dest_cpu >= nr_cpu_ids) {
ret = -EINVAL;