ANDROID: sched: Add vendor hooks for cpu affinity.
add vendor hooks for cpu affinity to support oem's feature. Bug: 183674818 Signed-off-by: lijianzhong <lijianzhong@xiaomi.com> Change-Id: I3402abec4d9faa08f564409bfb8db8d7902f3aa2
This commit is contained in:
@@ -247,3 +247,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_swappiness);
|
|||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_event);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_event);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_group);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_group);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpuset_fork);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpuset_fork);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_cpus_allowed_comm);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sched_setaffinity_early);
|
||||||
|
@@ -294,6 +294,14 @@ DECLARE_HOOK(android_vh_account_task_time,
|
|||||||
DECLARE_RESTRICTED_HOOK(android_rvh_post_init_entity_util_avg,
|
DECLARE_RESTRICTED_HOOK(android_rvh_post_init_entity_util_avg,
|
||||||
TP_PROTO(struct sched_entity *se),
|
TP_PROTO(struct sched_entity *se),
|
||||||
TP_ARGS(se), 1);
|
TP_ARGS(se), 1);
|
||||||
|
|
||||||
|
DECLARE_RESTRICTED_HOOK(android_rvh_set_cpus_allowed_comm,
|
||||||
|
TP_PROTO(struct task_struct *p, const struct cpumask *new_mask),
|
||||||
|
TP_ARGS(p, new_mask), 1);
|
||||||
|
|
||||||
|
DECLARE_HOOK(android_vh_sched_setaffinity_early,
|
||||||
|
TP_PROTO(struct task_struct *p, const struct cpumask *new_mask, int *retval),
|
||||||
|
TP_ARGS(p, new_mask, retval));
|
||||||
/* macro versions of hooks are no longer required */
|
/* macro versions of hooks are no longer required */
|
||||||
|
|
||||||
#endif /* _TRACE_HOOK_SCHED_H */
|
#endif /* _TRACE_HOOK_SCHED_H */
|
||||||
|
@@ -1884,6 +1884,7 @@ void set_cpus_allowed_common(struct task_struct *p, const struct cpumask *new_ma
|
|||||||
{
|
{
|
||||||
cpumask_copy(&p->cpus_mask, new_mask);
|
cpumask_copy(&p->cpus_mask, new_mask);
|
||||||
p->nr_cpus_allowed = cpumask_weight(new_mask);
|
p->nr_cpus_allowed = cpumask_weight(new_mask);
|
||||||
|
trace_android_rvh_set_cpus_allowed_comm(p, new_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask)
|
void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask)
|
||||||
@@ -6061,6 +6062,7 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
|
|||||||
cpumask_var_t cpus_allowed, new_mask;
|
cpumask_var_t cpus_allowed, new_mask;
|
||||||
struct task_struct *p;
|
struct task_struct *p;
|
||||||
int retval;
|
int retval;
|
||||||
|
int skip = 0;
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
|
|
||||||
@@ -6096,6 +6098,9 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
|
|||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trace_android_vh_sched_setaffinity_early(p, in_mask, &skip);
|
||||||
|
if (skip)
|
||||||
|
goto out_free_new_mask;
|
||||||
retval = security_task_setscheduler(p);
|
retval = security_task_setscheduler(p);
|
||||||
if (retval)
|
if (retval)
|
||||||
goto out_free_new_mask;
|
goto out_free_new_mask;
|
||||||
|
Reference in New Issue
Block a user