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.

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 855511173d
commit eb67f58322
3 changed files with 9 additions and 0 deletions

View File

@ -76,6 +76,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_set_user_nice,
TP_PROTO(struct task_struct *p, long *nice, bool *allowed),
TP_ARGS(p, nice, allowed), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_set_user_nice_locked,
TP_PROTO(struct task_struct *p, long *nice),
TP_ARGS(p, nice), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_setscheduler,
TP_PROTO(struct task_struct *p),
TP_ARGS(p), 1);

View File

@ -7234,6 +7234,10 @@ 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_locked(p, &nice);
if (task_nice(p) == nice)
goto out_unlock;
/*
* The RT priorities are set via sched_setscheduler(), but we still
* allow the 'normal' nice value to be set - but as expected

View File

@ -25,6 +25,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_finish_prio_fork);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_rtmutex_force_update);
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);