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:
Rick Yiu
2023-11-21 07:18:24 +00:00
committed by Todd Kjos
parent 484348c490
commit 039b2e0a92
3 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -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
View File
@@ -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
+1 -1
View File
@@ -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);