linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mm, oom: show process exiting information in __oom_kill_process()
@ 2020-07-21  1:01 Yafang Shao
  2020-07-21  6:06 ` Michal Hocko
  0 siblings, 1 reply; 2+ messages in thread
From: Yafang Shao @ 2020-07-21  1:01 UTC (permalink / raw)
  To: rientjes, mhocko, penguin-kernel, akpm, cai; +Cc: linux-mm, 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.

Suggested-by: David Rientjes <rientjes@google.com>
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Qian Cai <cai@lca.pw>

---
v1 -> v2:
- improve the output, per Tetsuo and Michal
---
 mm/oom_kill.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 6e94962893ee..c176c988c109 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -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) {
-- 
2.18.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] mm, oom: show process exiting information in __oom_kill_process()
  2020-07-21  1:01 [PATCH v2] mm, oom: show process exiting information in __oom_kill_process() Yafang Shao
@ 2020-07-21  6:06 ` Michal Hocko
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2020-07-21  6:06 UTC (permalink / raw)
  To: Yafang Shao; +Cc: rientjes, penguin-kernel, akpm, cai, linux-mm

On Mon 20-07-20 21:01:27, Yafang Shao wrote:
> 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.
> 
> Suggested-by: David Rientjes <rientjes@google.com>
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> Cc: Michal Hocko <mhocko@kernel.org>
> Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
> Cc: Qian Cai <cai@lca.pw>

Acked-by: Michal Hocko <mhocko@suse.com>

Thanks!

> ---
> v1 -> v2:
> - improve the output, per Tetsuo and Michal
> ---
>  mm/oom_kill.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 6e94962893ee..c176c988c109 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -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) {
> -- 
> 2.18.1

-- 
Michal Hocko
SUSE Labs


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-21  6:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-21  1:01 [PATCH v2] mm, oom: show process exiting information in __oom_kill_process() Yafang Shao
2020-07-21  6:06 ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).