ANDROID: vendor_hooks: add one hook for lazy preemption

add some changes to achieve the lazy preemption feature in our baseline.
- android_vh_set_tsk_need_resched_lazy

Bug: 424627098

Change-Id: I2c59f6ba7ef0fe4513e2febaa0f50f00dab8f3bc
Signed-off-by: liulu liu <liulu.liu@honor.corp-partner.google.com>
This commit is contained in:
liulu liu
2025-06-13 11:09:20 +08:00
committed by Treehugger Robot
parent 31e7de7400
commit 75547173ff
3 changed files with 10 additions and 1 deletions

View File

@@ -559,4 +559,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_early_resume_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_use_amu_fie);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_tsk_need_resched_lazy);

View File

@@ -150,6 +150,10 @@ DECLARE_HOOK(android_vh_exit_check,
DECLARE_RESTRICTED_HOOK(android_rvh_dpm_prepare,
TP_PROTO(int flag),
TP_ARGS(flag), 1);
DECLARE_HOOK(android_vh_set_tsk_need_resched_lazy,
TP_PROTO(struct task_struct *p, struct rq *rq, int *need_lazy),
TP_ARGS(p, rq, need_lazy));
#endif /* _TRACE_HOOK_DTASK_H */
/* This part must be outside protection */

View File

@@ -1136,13 +1136,17 @@ void wake_up_q(struct wake_q_head *head)
void resched_curr(struct rq *rq)
{
struct task_struct *curr = rq->curr;
int cpu;
int cpu, need_lazy = 0;
lockdep_assert_rq_held(rq);
if (test_tsk_need_resched(curr))
return;
trace_android_vh_set_tsk_need_resched_lazy(curr, rq, &need_lazy);
if (need_lazy)
return;
cpu = cpu_of(rq);
if (cpu == smp_processor_id()) {