ANDROID: psi: Add vendor hooks for PSI tracing
Add hooks to capture various per-zone memory stats when a trigger threshold is hit. In the stability Monkey4SystemLongTime test, the camera startup will request a large amount of memory in a short period of time, resulting in a temporary shortage of system memory. In addition, other processes also need to continuously request memory.In this case, it is easy for the system to have lmkd blocked and unable to kill the process in time, resulting in OOM. This hook can be used to detect when lmkd is in D state and the memory pressure meets the set conditions, then the kill process mechanism is triggered to avoid the occurrence of OOM. In the previous test, 1/20 machines had a problem at 74.49 hours,but after the modification, 48 machines were tested for 120 hours without any problems. Bug: 268290366 Change-Id: Ibe39263ddb05ffc3fa63b5225497a90c6480c8d7 Signed-off-by: Georgi Djakov <quic_c_gdjako@quicinc.com> Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
This commit is contained in:
committed by
Treehugger Robot
parent
c32849c569
commit
9fec5f6775
@@ -53,6 +53,7 @@
|
||||
#include <trace/hooks/topology.h>
|
||||
#include <trace/hooks/thermal.h>
|
||||
#include <trace/hooks/rwsem.h>
|
||||
#include <trace/hooks/psi.h>
|
||||
#include <trace/hooks/bl_hib.h>
|
||||
#include <trace/hooks/futex.h>
|
||||
#include <trace/hooks/bug.h>
|
||||
@@ -302,6 +303,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_freeze_todo);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_freeze_todo_unfrozen);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_die_kernel_fault);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_sp_pc_abort);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_event);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_group);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_dma_buf_stats_teardown);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dpm_wait_start);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dpm_wait_finish);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM psi
|
||||
|
||||
#define TRACE_INCLUDE_PATH trace/hooks
|
||||
|
||||
#if !defined(_TRACE_HOOK_PSI_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_HOOK_PSI_H
|
||||
|
||||
#include <trace/hooks/vendor_hooks.h>
|
||||
|
||||
struct psi_trigger;
|
||||
struct psi_group;
|
||||
DECLARE_HOOK(android_vh_psi_event,
|
||||
TP_PROTO(struct psi_trigger *t),
|
||||
TP_ARGS(t));
|
||||
|
||||
DECLARE_HOOK(android_vh_psi_group,
|
||||
TP_PROTO(struct psi_group *group),
|
||||
TP_ARGS(group));
|
||||
|
||||
#endif /* _TRACE_HOOK_PSI_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
||||
@@ -136,6 +136,7 @@
|
||||
* cost-wise, yet way more sensitive and accurate than periodic
|
||||
* sampling of the aggregate task states would be.
|
||||
*/
|
||||
#include <trace/hooks/psi.h>
|
||||
|
||||
static int psi_bug __read_mostly;
|
||||
|
||||
@@ -487,6 +488,8 @@ static void update_triggers(struct psi_group *group, u64 now,
|
||||
if (now < t->last_event_time + t->win.size)
|
||||
continue;
|
||||
|
||||
trace_android_vh_psi_event(t);
|
||||
|
||||
/* Generate an event */
|
||||
if (cmpxchg(&t->event, 0, 1) == 0) {
|
||||
if (t->of)
|
||||
@@ -498,6 +501,8 @@ static void update_triggers(struct psi_group *group, u64 now,
|
||||
/* Reset threshold breach flag once event got generated */
|
||||
t->pending_event = false;
|
||||
}
|
||||
|
||||
trace_android_vh_psi_group(group);
|
||||
}
|
||||
|
||||
static u64 update_averages(struct psi_group *group, u64 now)
|
||||
|
||||
Reference in New Issue
Block a user