mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 22:14:04 +02:00
ANDROID: hung_task: Add vendor hook for hung task detect
Add vendor hook for hung task detect, so we can decide which threads need to check, avoiding false alarms. Bug: 188684133 Signed-off-by: Huang Yiwei <hyiwei@codeaurora.org> Change-Id: I5d7dfeb071cbfda8121134c38a458202aaa3a8c6
This commit is contained in:
parent
1b6f2f6e29
commit
17b9c24b25
|
|
@ -55,6 +55,7 @@
|
||||||
#include <trace/hooks/vmscan.h>
|
#include <trace/hooks/vmscan.h>
|
||||||
#include <trace/hooks/psi.h>
|
#include <trace/hooks/psi.h>
|
||||||
#include <trace/hooks/selinux.h>
|
#include <trace/hooks/selinux.h>
|
||||||
|
#include <trace/hooks/hung_task.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Export tracepoints that act as a bare tracehook (ie: have no trace event
|
* Export tracepoints that act as a bare tracehook (ie: have no trace event
|
||||||
|
|
@ -283,3 +284,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_update_topology_flags_workfn);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_of_i2c_get_board_info);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_of_i2c_get_board_info);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cgroup_attach);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cgroup_attach);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_dirty_limits);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_dirty_limits);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_uninterruptible_tasks);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_uninterruptible_tasks_dn);
|
||||||
|
|
|
||||||
24
include/trace/hooks/hung_task.h
Normal file
24
include/trace/hooks/hung_task.h
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
|
#undef TRACE_SYSTEM
|
||||||
|
#define TRACE_SYSTEM hung_task
|
||||||
|
|
||||||
|
#define TRACE_INCLUDE_PATH trace/hooks
|
||||||
|
|
||||||
|
#if !defined(_TRACE_HOOK_HUNG_TASK_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||||
|
#define _TRACE_HOOK_HUNG_TASK_H
|
||||||
|
|
||||||
|
#include <linux/tracepoint.h>
|
||||||
|
#include <trace/hooks/vendor_hooks.h>
|
||||||
|
|
||||||
|
DECLARE_HOOK(android_vh_check_uninterruptible_tasks,
|
||||||
|
TP_PROTO(struct task_struct *t, unsigned long timeout,
|
||||||
|
bool *need_check),
|
||||||
|
TP_ARGS(t, timeout, need_check));
|
||||||
|
|
||||||
|
DECLARE_HOOK(android_vh_check_uninterruptible_tasks_dn,
|
||||||
|
TP_PROTO(void *unused),
|
||||||
|
TP_ARGS(unused));
|
||||||
|
|
||||||
|
#endif /* _TRACE_HOOK_HUNG_TASK_H */
|
||||||
|
/* This part must be outside protection */
|
||||||
|
#include <trace/define_trace.h>
|
||||||
|
|
@ -23,6 +23,8 @@
|
||||||
#include <linux/sched/sysctl.h>
|
#include <linux/sched/sysctl.h>
|
||||||
|
|
||||||
#include <trace/events/sched.h>
|
#include <trace/events/sched.h>
|
||||||
|
#undef CREATE_TRACE_POINTS
|
||||||
|
#include <trace/hooks/hung_task.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The number of tasks checked:
|
* The number of tasks checked:
|
||||||
|
|
@ -177,6 +179,7 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
|
||||||
int max_count = sysctl_hung_task_check_count;
|
int max_count = sysctl_hung_task_check_count;
|
||||||
unsigned long last_break = jiffies;
|
unsigned long last_break = jiffies;
|
||||||
struct task_struct *g, *t;
|
struct task_struct *g, *t;
|
||||||
|
bool need_check = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the system crashed already then all bets are off,
|
* If the system crashed already then all bets are off,
|
||||||
|
|
@ -195,10 +198,13 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
|
||||||
goto unlock;
|
goto unlock;
|
||||||
last_break = jiffies;
|
last_break = jiffies;
|
||||||
}
|
}
|
||||||
/* use "==" to skip the TASK_KILLABLE tasks waiting on NFS */
|
trace_android_vh_check_uninterruptible_tasks(t, timeout, &need_check);
|
||||||
if (t->state == TASK_UNINTERRUPTIBLE)
|
if (need_check)
|
||||||
check_hung_task(t, timeout);
|
/* use "==" to skip the TASK_KILLABLE tasks waiting on NFS */
|
||||||
|
if (t->state == TASK_UNINTERRUPTIBLE)
|
||||||
|
check_hung_task(t, timeout);
|
||||||
}
|
}
|
||||||
|
trace_android_vh_check_uninterruptible_tasks_dn(NULL);
|
||||||
unlock:
|
unlock:
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
if (hung_task_show_lock)
|
if (hung_task_show_lock)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user