diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 73847cacaae2..4b01c4e6a31d 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -198,6 +198,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_memory_nx); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_memory_rw); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_module_permit_before_init); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_module_permit_after_init); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_oom_check_panic); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_selinux_is_initialized); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_mmap_file); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_file_open); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 22dcee0d90a1..36bafc54e4bb 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -9,6 +9,8 @@ #include +#include +#include #include #include @@ -21,6 +23,9 @@ DECLARE_RESTRICTED_HOOK(android_rvh_set_gfp_zone_flags, DECLARE_RESTRICTED_HOOK(android_rvh_set_readahead_gfp_mask, TP_PROTO(gfp_t *flags), TP_ARGS(flags), 1); +DECLARE_HOOK(android_vh_oom_check_panic, + TP_PROTO(struct oom_control *oc, int *ret), + TP_ARGS(oc, ret)); #endif /* _TRACE_HOOK_MM_H */ diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 2d5452f19afd..bd42d3701641 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -52,6 +52,9 @@ #define CREATE_TRACE_POINTS #include +#undef CREATE_TRACE_POINTS +#include + int sysctl_panic_on_oom; int sysctl_oom_kill_allocating_task; int sysctl_oom_dump_tasks = 1; @@ -1103,6 +1106,12 @@ bool out_of_memory(struct oom_control *oc) select_bad_process(oc); /* Found nothing?!?! */ if (!oc->chosen) { + int ret = false; + + trace_android_vh_oom_check_panic(oc, &ret); + if (ret) + return true; + dump_header(oc, NULL); pr_warn("Out of memory and no killable processes...\n"); /*