ANDROID: sched: move vendor hook to check scheduling nice value

move hook to collect scheduling information and apply vendor's
tuning before task's scheduling priority is changed

Bug: 163431711

Signed-off-by: Frankie Chang <frankie.chang@mediatek.com>
Change-Id: I61a7ab663316c0fbcb28d1b6e523649a6374b492
(cherry picked from commit 5cf5bc7523bd5608590de487de896c1026161a18)
This commit is contained in:
Frankie Chang 2021-01-12 12:32:54 +08:00
parent 32ff5fbcab
commit 66da798d24
2 changed files with 5 additions and 5 deletions

View File

@ -58,8 +58,8 @@ DECLARE_RESTRICTED_HOOK(android_rvh_rtmutex_prepare_setprio,
TP_ARGS(p, pi_task), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_set_user_nice,
TP_PROTO(struct task_struct *p, long *nice),
TP_ARGS(p, nice), 1);
TP_PROTO(struct task_struct *p, long *nice, bool *allowed),
TP_ARGS(p, nice, allowed), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_setscheduler,
TP_PROTO(struct task_struct *p),

View File

@ -4605,12 +4605,13 @@ static inline int rt_effective_prio(struct task_struct *p, int prio)
void set_user_nice(struct task_struct *p, long nice)
{
bool queued, running;
bool queued, running, allowed = false;
int old_prio, delta;
struct rq_flags rf;
struct rq *rq;
if (task_nice(p) == nice || nice < MIN_NICE || nice > MAX_NICE)
trace_android_rvh_set_user_nice(p, &nice, &allowed);
if ((task_nice(p) == nice || nice < MIN_NICE || nice > MAX_NICE) && !allowed)
return;
/*
* We have to be careful, if called from sys_setpriority(),
@ -4618,7 +4619,6 @@ void set_user_nice(struct task_struct *p, long nice)
*/
rq = task_rq_lock(p, &rf);
update_rq_clock(rq);
trace_android_rvh_set_user_nice(p, &nice);
/*
* The RT priorities are set via sched_setscheduler(), but we still