mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
ANDROID: sched: Add vendor hooks for cpu affinity.
Add vendor hooks for CPU affinity to support OEM's tuning policy, where we can block or unblock a certain type of application's CPU affinity. Bug: 183674818 Bug: 283222331 Signed-off-by: lijianzhong <lijianzhong@xiaomi.com> Change-Id: I3402abec4d9faa08f564409bfb8db8d7902f3aa2 (cherry picked from commit 7cf9646c245fdc63e2a3c9fad457c11fabdd2dfc)
This commit is contained in:
committed by
Qiankun Wang
parent
53a5908faa
commit
555f3fe563
@@ -436,6 +436,14 @@ DECLARE_RESTRICTED_HOOK(android_rvh_update_rt_rq_load_avg,
|
||||
TP_PROTO(u64 now, struct rq *rq, struct task_struct *tsk, int running),
|
||||
TP_ARGS(now, rq, tsk, running), 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, bool *retval),
|
||||
TP_ARGS(p, new_mask, retval));
|
||||
|
||||
/* macro versions of hooks are no longer required */
|
||||
|
||||
#endif /* _TRACE_HOOK_SCHED_H */
|
||||
|
||||
@@ -2524,6 +2524,7 @@ void set_cpus_allowed_common(struct task_struct *p, const struct cpumask *new_ma
|
||||
|
||||
cpumask_copy(&p->cpus_mask, new_mask);
|
||||
p->nr_cpus_allowed = cpumask_weight(new_mask);
|
||||
trace_android_rvh_set_cpus_allowed_comm(p, new_mask);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -8205,7 +8206,8 @@ out_free_cpus_allowed:
|
||||
long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
|
||||
{
|
||||
struct task_struct *p;
|
||||
int retval;
|
||||
int retval = 0;
|
||||
bool skip = false;
|
||||
|
||||
rcu_read_lock();
|
||||
|
||||
@@ -8234,6 +8236,9 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
trace_android_vh_sched_setaffinity_early(p, in_mask, &skip);
|
||||
if (skip)
|
||||
goto out_put_task;
|
||||
retval = security_task_setscheduler(p);
|
||||
if (retval)
|
||||
goto out_put_task;
|
||||
|
||||
@@ -107,3 +107,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_remove_entity_load_avg);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_blocked_fair);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_rt_rq_load_avg);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_cpus_allowed_by_task);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_cpus_allowed_comm);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sched_setaffinity_early);
|
||||
|
||||
Reference in New Issue
Block a user