From e9ddfc8eeafb82db8c4d465d1e8c1ab930cc49f2 Mon Sep 17 00:00:00 2001 From: Patrick Daly Date: Wed, 8 May 2019 16:10:43 -0700 Subject: [PATCH] mm, oom: Modify default value of panic_on_oom If a userspace low memory killer is present, the kernel oom killer is not expected to be invoked. Therefore, trigger a reset on any such occurrence. Change-Id: I7f3451e9c4deb843b3e4dfa13e9764101e90b8ae Signed-off-by: Patrick Daly Signed-off-by: Chris Goldsworthy --- mm/Kconfig.debug | 8 ++++++++ mm/oom_kill.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug index adfdd670f951..46615e0bdb35 100644 --- a/mm/Kconfig.debug +++ b/mm/Kconfig.debug @@ -48,6 +48,14 @@ config SLUB_DEBUG_PANIC_ON investigating the root cause which may be rooted within cache or memory. +config DEBUG_PANIC_ON_OOM + bool "Enable to Panic on OOM detection" + help + Android primarily uses an alternative mechanism to detect low + memory situations and kill processes as required. The kernel + oom-killer can mask problems with this feature, which may be + undesireable in a debug environment. + config DEBUG_PAGEALLOC_ENABLE_DEFAULT bool "Enable debug page memory allocations by default?" depends on DEBUG_PAGEALLOC diff --git a/mm/oom_kill.c b/mm/oom_kill.c index e533368a9cee..1b076aa6a1e6 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -52,7 +52,8 @@ #define CREATE_TRACE_POINTS #include -int sysctl_panic_on_oom; +int sysctl_panic_on_oom = +IS_ENABLED(CONFIG_DEBUG_PANIC_ON_OOM) ? 2 : 0; int sysctl_oom_kill_allocating_task; int sysctl_oom_dump_tasks = 1; int sysctl_reap_mem_on_sigkill;