mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-14 05:09:36 +02:00
ANDROID: vendor_hooks: add two hooks for lazy preemption
add some changes to achieve the lazy preemption feature in our baseline. - android_vh_read_lazy_flag - android_vh_set_tsk_need_resched_lazy Bug: 336982374 Change-Id: I297192a3276bcb18663f5e6ffbb084ec8a8eef7a Signed-off-by: xieliujie <xieliujie@oppo.com>
This commit is contained in:
parent
858a548331
commit
3f6eaa6a3c
|
@ -20,6 +20,8 @@
|
|||
#include <linux/ratelimit.h>
|
||||
#include <linux/syscalls.h>
|
||||
|
||||
#include <trace/hooks/dtask.h>
|
||||
|
||||
#include <asm/daifflags.h>
|
||||
#include <asm/debug-monitors.h>
|
||||
#include <asm/elf.h>
|
||||
|
@ -1280,8 +1282,11 @@ static void do_signal(struct pt_regs *regs)
|
|||
|
||||
void do_notify_resume(struct pt_regs *regs, unsigned long thread_flags)
|
||||
{
|
||||
int thread_lazy_flag = 0;
|
||||
|
||||
do {
|
||||
if (thread_flags & _TIF_NEED_RESCHED) {
|
||||
trace_android_vh_read_lazy_flag(&thread_lazy_flag, &thread_flags);
|
||||
if ((thread_flags & _TIF_NEED_RESCHED) || thread_lazy_flag) {
|
||||
/* Unmask Debug and SError for the next task */
|
||||
local_daif_restore(DAIF_PROCCTX_NOIRQ);
|
||||
|
||||
|
|
|
@ -400,3 +400,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_madvise_cold_pageout_skip);
|
|||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_event);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_group);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmc_sdio_pm_flag_set);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_read_lazy_flag);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_tsk_need_resched_lazy);
|
||||
|
|
|
@ -132,6 +132,14 @@ DECLARE_HOOK(android_vh_record_rwsem_lock_starttime,
|
|||
DECLARE_HOOK(android_vh_record_pcpu_rwsem_starttime,
|
||||
TP_PROTO(struct percpu_rw_semaphore *sem, unsigned long settime_jiffies),
|
||||
TP_ARGS(sem, settime_jiffies));
|
||||
|
||||
DECLARE_HOOK(android_vh_read_lazy_flag,
|
||||
TP_PROTO(int *thread_lazy_flag, unsigned long *thread_flags),
|
||||
TP_ARGS(thread_lazy_flag, thread_flags));
|
||||
|
||||
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 */
|
||||
|
|
|
@ -1065,13 +1065,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()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user