linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: rientjes@google.com, penguin-kernel@i-love.sakura.ne.jp,
	akpm@linux-foundation.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm, oom: show process exiting information in __oom_kill_process()
Date: Mon, 20 Jul 2020 09:16:07 +0200	[thread overview]
Message-ID: <20200720071607.GA18535@dhcp22.suse.cz> (raw)
In-Reply-To: <1595166795-27587-1-git-send-email-laoar.shao@gmail.com>

On Sun 19-07-20 09:53:15, 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>
> ---
>  mm/oom_kill.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 6e94962..0480dde 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -863,9 +863,13 @@ static void __oom_kill_process(struct task_struct *victim, const char *message)
>  
>  	p = find_lock_task_mm(victim);
>  	if (!p) {
> +		pr_info("Process %d (%s) is already exiting\n",
> +			task_pid_nr(victim), victim->comm);
>  		put_task_struct(victim);

I do agree that a silent bail out is not the best thing to do. The above
message would be more useful if it also explained what the oom killer
does (or does not):

	"OOM victim %d (%s) is already exiting. Skip killing the task\n"

>  		return;
> -	} else if (victim != p) {
> +	}
> +
> +	if (victim != p) {

Why do we need this?

>  		get_task_struct(p);
>  		put_task_struct(victim);
>  		victim = p;
> -- 
> 1.8.3.1

-- 
Michal Hocko
SUSE Labs


  parent reply	other threads:[~2020-07-20  7:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-19 13:53 [PATCH] mm, oom: show process exiting information in __oom_kill_process() Yafang Shao
2020-07-19 23:20 ` Tetsuo Handa
2020-07-20  1:43   ` Yafang Shao
2020-07-20  7:16 ` Michal Hocko [this message]
2020-07-20 10:36   ` Yafang Shao
2020-07-20 11:06     ` Tetsuo Handa
2020-07-20 12:19       ` Yafang Shao
2020-07-20 13:11         ` Tetsuo Handa
2020-07-20 13:59           ` Yafang Shao
2020-07-20 13:41       ` Michal Hocko
2020-07-20 14:03         ` Tetsuo Handa
2020-07-20 14:23           ` Michal Hocko
2020-07-20 13:35     ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200720071607.GA18535@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=laoar.shao@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).