Skip to contentSkip to conversation

mm, oom: show process exiting information in __oom_kill_process()

PATCH Applied Yafang Shao 2 participants 2 messages Jul 21, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mm, oom: show process exiting information in __oom_kill_process()

When the OOM killer finding a victim and trying to kill it, if the victim is already exiting, the task mm will be NULL and no process will be killed. But the dump_header() has been already executed, so it will be strange to dump so many information without killing a process. We'd better show some helpful information to indicate why this happens.

---
v1 -> v2:
- improve the output, per Tetsuo and Michal

---
 mm/oom_kill.c | 2 ++
 1 file changed, 2 insertions(+)
mm/oom_kill.c +2 -0
index 6e94962893ee..c176c988c109 100644
@@ -863,6 +863,8 @@ static void __oom_kill_process(struct task_struct *victim, const char *message)
 
 	p = find_lock_task_mm(victim);
 	if (!p) {
+		pr_info("%s: OOM victim %d (%s) is already exiting. Skip killing the task\n",
+			message, task_pid_nr(victim), victim->comm);
 		put_task_struct(victim);
 		return;
 	} else if (victim != p) {
Signature · 1 line
2.18.1
Acked-by on v2 1/1
#1 lore raw
Quoted 11 lines · Yafang Shao

When the OOM killer finding a victim and trying to kill it, if the victim is already exiting, the task mm will be NULL and no process will be killed. But the dump_header() has been already executed, so it will be strange to dump so many information without killing a process. We'd better show some helpful information to indicate why this happens.

Thanks!

Quoted 22 lines

---
v1 -> v2:
- improve the output, per Tetsuo and Michal

---
 mm/oom_kill.c | 2 ++
 1 file changed, 2 insertions(+)
mm/oom_kill.c +2 -0
index 6e94962893ee..c176c988c109 100644
@@ -863,6 +863,8 @@ static void __oom_kill_process(struct task_struct *victim, const char *message)
 
 	p = find_lock_task_mm(victim);
 	if (!p) {
+		pr_info("%s: OOM victim %d (%s) is already exiting. Skip killing the task\n",
+			message, task_pid_nr(victim), victim->comm);
 		put_task_struct(victim);
 		return;
 	} else if (victim != p) {
Signature · 1 line
2.18.1
Signature · 2 lines
Michal Hocko
SUSE Labs