ANDROID: mm, oom: add vendor hook to prevent oom panic
In some cases we would like to bypass oom panic and give the system more time to cleanup memory. Add vendor hook to allow skipping the oom panic. Bug: 186875166 Change-Id: I64e74b2c013d6f18d74504777c6559d9ae07e008 Signed-off-by: Prakash Gupta <guptap@codeaurora.org>
This commit is contained in:
@@ -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_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_oom_check_panic);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_uninterruptible_tasks);
|
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_check_uninterruptible_tasks_dn);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmc_blk_reset);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmc_blk_reset);
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
|
#include <linux/oom.h>
|
||||||
#include <linux/tracepoint.h>
|
#include <linux/tracepoint.h>
|
||||||
#include <trace/hooks/vendor_hooks.h>
|
#include <trace/hooks/vendor_hooks.h>
|
||||||
|
|
||||||
@@ -78,6 +79,9 @@ DECLARE_HOOK(android_vh_mm_dirty_limits,
|
|||||||
unsigned long nr_reclaimable, unsigned long pages_dirtied),
|
unsigned long nr_reclaimable, unsigned long pages_dirtied),
|
||||||
TP_ARGS(gdtc, strictlimit, dirty, bg_thresh,
|
TP_ARGS(gdtc, strictlimit, dirty, bg_thresh,
|
||||||
nr_reclaimable, pages_dirtied));
|
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,
|
DECLARE_HOOK(android_vh_save_vmalloc_stack,
|
||||||
TP_PROTO(unsigned long flags, struct vm_struct *vm),
|
TP_PROTO(unsigned long flags, struct vm_struct *vm),
|
||||||
TP_ARGS(flags, vm));
|
TP_ARGS(flags, vm));
|
||||||
|
@@ -51,6 +51,9 @@
|
|||||||
#define CREATE_TRACE_POINTS
|
#define CREATE_TRACE_POINTS
|
||||||
#include <trace/events/oom.h>
|
#include <trace/events/oom.h>
|
||||||
|
|
||||||
|
#undef CREATE_TRACE_POINTS
|
||||||
|
#include <trace/hooks/mm.h>
|
||||||
|
|
||||||
int sysctl_panic_on_oom;
|
int sysctl_panic_on_oom;
|
||||||
int sysctl_oom_kill_allocating_task;
|
int sysctl_oom_kill_allocating_task;
|
||||||
int sysctl_oom_dump_tasks = 1;
|
int sysctl_oom_dump_tasks = 1;
|
||||||
@@ -1146,6 +1149,12 @@ bool out_of_memory(struct oom_control *oc)
|
|||||||
select_bad_process(oc);
|
select_bad_process(oc);
|
||||||
/* Found nothing?!?! */
|
/* Found nothing?!?! */
|
||||||
if (!oc->chosen) {
|
if (!oc->chosen) {
|
||||||
|
int ret = false;
|
||||||
|
|
||||||
|
trace_android_vh_oom_check_panic(oc, &ret);
|
||||||
|
if (ret)
|
||||||
|
return true;
|
||||||
|
|
||||||
dump_header(oc, NULL);
|
dump_header(oc, NULL);
|
||||||
pr_warn("Out of memory and no killable processes...\n");
|
pr_warn("Out of memory and no killable processes...\n");
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user