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
parent 483887d651
commit a024fc656b
3 changed files with 8 additions and 0 deletions

View File

@@ -156,6 +156,7 @@ 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_set_cpus_allowed_by_task);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_post_init_entity_util_avg);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_uclamp_eff_get);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_util_est_update);

View File

@@ -194,6 +194,11 @@ DECLARE_RESTRICTED_HOOK(android_rvh_check_preempt_wakeup,
TP_ARGS(rq, p, preempt, nopreempt, wake_flags, se, pse, next_buddy_marked,
granularity), 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_HOOK(android_vh_free_task,
TP_PROTO(struct task_struct *p),
TP_ARGS(p));

View File

@@ -2950,6 +2950,8 @@ static int __set_cpus_allowed_ptr_locked(struct task_struct *p,
* immediately required to distribute the tasks within their new mask.
*/
dest_cpu = cpumask_any_and_distribute(cpu_valid_mask, new_mask);
trace_android_rvh_set_cpus_allowed_by_task(cpu_valid_mask, new_mask, p, &dest_cpu);
if (dest_cpu >= nr_cpu_ids) {
ret = -EINVAL;
goto out;