diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index 8173569953ba..99641b8d3c1a 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -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), diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 58a4f6a63547..e57809458da0 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5743,12 +5743,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; 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(), @@ -5756,7 +5757,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