oom: improve oom disable handling
PATCH 1/1 oom: improve oom disable handling
From: Michal Hocko <[email protected]>
Tetsuo has reported that sysrq triggered OOM killer will print a misleading information when no tasks are selected:
[ 713.805315] sysrq: SysRq : Manual OOM execution [ 713.808920] Out of memory: Kill process 4468 ((agetty)) score 0 or sacrifice child [ 713.814913] Killed process 4468 ((agetty)) total-vm:43704kB, anon-rss:1760kB, file-rss:0kB, shmem-rss:0kB [ 714.004805] sysrq: SysRq : Manual OOM execution [ 714.005936] Out of memory: Kill process 4469 (systemd-cgroups) score 0 or sacrifice child [ 714.008117] Killed process 4469 (systemd-cgroups) total-vm:10704kB, anon-rss:120kB, file-rss:0kB, shmem-rss:0kB [ 714.189310] sysrq: SysRq : Manual OOM execution [ 714.193425] sysrq: OOM request ignored because killer is disabled [ 714.381313] sysrq: SysRq : Manual OOM execution [ 714.385158] sysrq: OOM request ignored because killer is disabled [ 714.573320] sysrq: SysRq : Manual OOM execution [ 714.576988] sysrq: OOM request ignored because killer is disabled
The real reason is that there are no eligible tasks for the OOM killer to select but since 7c5f64f84483bd13 ("mm: oom: deduplicate victim selection code for memcg and global oom") the semantic of out_of_memory has changed without updating moom_callback.
This patch updates moom_callback to tell that no task was eligible which is the case for both oom killer disabled and no eligible tasks. In order to help distinguish first case from the second add printk to both oom_killer_{enable,disable}. This information is useful on its own because it might help debugging potential memory allocation failures.
--- drivers/tty/sysrq.c | 2 +- mm/oom_kill.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/tty/sysrq.c +1 -1
@@ -370,7 +370,7 @@ static void moom_callback(struct work_struct *ignored)mutex_lock (&oom_lock);if (!out_of_memory (&oc)) -pr_info ("OOM request ignored because killer is disabled\n" ); +pr_info ("OOM request ignored. No task eligible\n" );mutex_unlock (&oom_lock); }
mm/oom_kill.c +2 -0
@@ -682,6 +682,7 @@ void exit_oom_victim(void)void oom_killer_enable (void ) { oom_killer_disabled = false; +pr_info ("OOM killer enabled.\n" ); }/**
@@ -718,6 +719,7 @@ bool oom_killer_disable(signed long timeout)oom_killer_enable ();return false; } +pr_info ("OOM killer disabled.\n" );return true; }
Signature · 7 lines
2.11.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Hi, Michal
If the subject is "improve the log message on oom disable handling" would be more accurate to me.
The original subject sounds the patch will adjust the code path, while it doesn't.
Quoted 72 lines · Michal Hocko
From: Michal Hocko <[email protected]>
Tetsuo has reported that sysrq triggered OOM killer will print a misleading information when no tasks are selected:
[ 713.805315] sysrq: SysRq : Manual OOM execution [ 713.808920] Out of memory: Kill process 4468 ((agetty)) score 0 or sacrifice child [ 713.814913] Killed process 4468 ((agetty)) total-vm:43704kB, anon-rss:1760kB, file-rss:0kB, shmem-rss:0kB [ 714.004805] sysrq: SysRq : Manual OOM execution [ 714.005936] Out of memory: Kill process 4469 (systemd-cgroups) score 0 or sacrifice child [ 714.008117] Killed process 4469 (systemd-cgroups) total-vm:10704kB, anon-rss:120kB, file-rss:0kB, shmem-rss:0kB [ 714.189310] sysrq: SysRq : Manual OOM execution [ 714.193425] sysrq: OOM request ignored because killer is disabled [ 714.381313] sysrq: SysRq : Manual OOM execution [ 714.385158] sysrq: OOM request ignored because killer is disabled [ 714.573320] sysrq: SysRq : Manual OOM execution [ 714.576988] sysrq: OOM request ignored because killer is disabledThe real reason is that there are no eligible tasks for the OOM killer to select but since
7c5f64f84483bd13("mm: oom: deduplicate victim selection code for memcg and global oom") the semantic ofout_of_memoryhas changed without updatingmoom_callback.This patch updates
moom_callbackto tell that no task was eligible which is the case for both oom killer disabled and no eligible tasks. In order to help distinguish first case from the second add printk to both oom_killer_{enable,disable}. This information is useful on its own because it might help debugging potential memory allocation failures.Fixes 7c5f64f84483bd13 ("mm: oom: deduplicate victim selection code for memcg and global oom")Reported-by Tetsuo Handa <[email protected]>Signed-off-by Michal Hocko <[email protected]>---
drivers/tty/sysrq.c| 2 +-mm/oom_kill.c| 2 ++2 files changed, 3 insertions(+), 1 deletion(-)drivers/tty/sysrq.c +1
-1@@ -370,7 +370,7 @@ static void moom_callback(struct work_struct *ignored)mutex_lock (&oom_lock);if (!out_of_memory (&oc)) -pr_info ("OOM request ignored because killer is disabled\n" ); +pr_info ("OOM request ignored. No task eligible\n" );mutex_unlock (&oom_lock); }mm/oom_kill.c +2
-0@@ -682,6 +682,7 @@ void exit_oom_victim(void)void oom_killer_enable (void ) { oom_killer_disabled = false; +pr_info ("OOM killer enabled.\n" ); }/** @@ -718,6 +719,7 @@ bool oom_killer_disable(signed long timeout)oom_killer_enable ();return false; } +pr_info ("OOM killer disabled.\n" );return true; }Signature · 1 line
2.11.0
Signature · 2 lines
Wei Yang Help you, Help me