diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index d16aa3d3e2bb..f53d2de118e5 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -285,6 +285,7 @@ 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_cgroup_attach); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_dirty_limits); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_oom_check_panic); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_uninterruptible_tasks); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_uninterruptible_tasks_dn); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmc_blk_reset); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index e6cec50cf1f4..99655b3657ee 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -78,6 +79,9 @@ DECLARE_HOOK(android_vh_mm_dirty_limits, unsigned long nr_reclaimable, unsigned long pages_dirtied), TP_ARGS(gdtc, strictlimit, dirty, bg_thresh, nr_reclaimable, pages_dirtied)); +DECLARE_HOOK(android_vh_oom_check_panic, + TP_PROTO(struct oom_control *oc, int *ret), + TP_ARGS(oc, ret)); DECLARE_HOOK(android_vh_save_vmalloc_stack, TP_PROTO(unsigned long flags, struct vm_struct *vm), TP_ARGS(flags, vm)); diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 9072352545aa..acf064f3fc4e 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -51,6 +51,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; @@ -1146,6 +1149,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"); /*