ANDROID: sched: Add trace_android_rvh_set_user_nice_locked
We will need vendor hook of set_user_nice with lock to avoid race condition. Remove the unlocked version as well. Bug: 300872872 Change-Id: I24fc1e13cc6578dcc418d956a5146ad29ff76a56 Signed-off-by: Rick Yiu <rickyiu@google.com>
This commit is contained in:
@@ -68,7 +68,7 @@ DECLARE_RESTRICTED_HOOK(android_rvh_get_nohz_timer_target,
|
||||
TP_PROTO(int *cpu, bool *done),
|
||||
TP_ARGS(cpu, done), 1);
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_set_user_nice,
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_set_user_nice_locked,
|
||||
TP_PROTO(struct task_struct *p, long *nice, bool *allowed),
|
||||
TP_ARGS(p, nice, allowed), 1);
|
||||
|
||||
|
||||
+6
-3
@@ -7303,12 +7303,11 @@ 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, allowed = false;
|
||||
bool queued, running, allowed = true;
|
||||
struct rq *rq;
|
||||
int old_prio;
|
||||
|
||||
trace_android_rvh_set_user_nice(p, &nice, &allowed);
|
||||
if ((task_nice(p) == nice || nice < MIN_NICE || nice > MAX_NICE) && !allowed)
|
||||
if (task_nice(p) == nice || nice < MIN_NICE || nice > MAX_NICE)
|
||||
return;
|
||||
/*
|
||||
* We have to be careful, if called from sys_setpriority(),
|
||||
@@ -7319,6 +7318,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
|
||||
|
||||
@@ -23,7 +23,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_find_lowest_rq);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_prepare_prio_fork);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_finish_prio_fork);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_rtmutex_prepare_setprio);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_user_nice);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_user_nice_locked);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_setscheduler);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_find_busiest_group);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dump_throttled_rt_tasks);
|
||||
|
||||
Reference in New Issue
Block a user