ANDROID: sched: Add trace_android_rvh_set_user_nice_locked

We will need vendor hook of set_user_nice with lock to avoid race

The purpose of hooking set_user_nice is to allow vendor to hack the
task prio from other userspace processes like framework, so that
vendor could tune the prio of important tasks. Since it is a hack,
there should be not much that upstream could do.
condition.

Bug: 344826816
Bug: 300872872
Change-Id: I24fc1e13cc6578dcc418d956a5146ad29ff76a56
Signed-off-by: Rick Yiu <rickyiu@google.com>
(cherry picked from commit eb67f583227fd814a207ea88897ff6d6cf5665c1)
Signed-off-by: Qais Yousef <qyousef@google.com>
This commit is contained in:
Rick Yiu
2023-11-21 07:18:24 +00:00
committed by Treehugger Robot
parent 2ab1628371
commit 401be11d93

View File

@@ -70,6 +70,7 @@ void set_user_nice(struct task_struct *p, long nice)
bool queued, running;
struct rq *rq;
int old_prio;
bool allowed = true;
trace_android_rvh_set_user_nice(p, &nice);
if (task_nice(p) == nice || nice < MIN_NICE || nice > MAX_NICE)
@@ -83,6 +84,10 @@ void set_user_nice(struct task_struct *p, long nice)
update_rq_clock(rq);
trace_android_rvh_set_user_nice_locked(p, &nice, &allowed);
if (!allowed)
return;
/*
* The RT priorities are set via sched_setscheduler(), but we still
* allow the 'normal' nice value to be set - but as expected