ANDROID: sched: vendor hook for sched_getaffinity

Just as sched_getaffinity updates the affinity based upon the
active_mask, the vendor hook needs to be able to constrain
the task's affinity.

Introduce a hook to sched_getaffinity such that vendor modules used for
implementing Qualcomm's load tracking scheme, WALT are able to update the
affinity.

Bug: 229133948
Change-Id: I5c501e9204d4fcc6688f675a41be60ef5a2d1075
Signed-off-by: Stephen Dickey <quic_dickey@quicinc.com>
Signed-off-by: Ashay Jaiswal <quic_ashayj@quicinc.com>
This commit is contained in:
Stephen Dickey
2022-04-13 09:25:18 -07:00
committed by Todd Kjos
parent 6fb5714d19
commit 4c58a1addc
3 changed files with 6 additions and 0 deletions

View File

@@ -124,6 +124,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_sched_setaffinity,
TP_PROTO(struct task_struct *p, const struct cpumask *in_mask, int *retval),
TP_ARGS(p, in_mask, retval), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_sched_getaffinity,
TP_PROTO(struct task_struct *p, struct cpumask *in_mask),
TP_ARGS(p, in_mask), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_update_cpus_allowed,
TP_PROTO(struct task_struct *p, cpumask_var_t cpus_requested,
const struct cpumask *new_mask, int *ret),

View File

@@ -8303,6 +8303,7 @@ long sched_getaffinity(pid_t pid, struct cpumask *mask)
raw_spin_lock_irqsave(&p->pi_lock, flags);
cpumask_and(mask, &p->cpus_mask, cpu_active_mask);
trace_android_rvh_sched_getaffinity(p, mask);
raw_spin_unlock_irqrestore(&p->pi_lock, flags);
out_unlock:

View File

@@ -74,3 +74,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_misfit_status);
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);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_getaffinity);