linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
To: Michal Hocko <mhocko@kernel.org>, David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [patch] mm, oom: dump stack of victim when reaping failed
Date: Wed, 15 Jan 2020 18:18:25 +0900	[thread overview]
Message-ID: <9a7cbbf0-4283-f932-e422-84b4fb42a055@I-love.SAKURA.ne.jp> (raw)
In-Reply-To: <20200115084336.GW19428@dhcp22.suse.cz>

On 2020/01/15 17:43, Michal Hocko wrote:
> On Tue 14-01-20 15:20:04, David Rientjes wrote:
>> When a process cannot be oom reaped, for whatever reason, currently the
>> list of locks that are held is currently dumped to the kernel log.
>>
>> Much more interesting is the stack trace of the victim that cannot be
>> reaped.  If the stack trace is dumped, we have the ability to find
>> related occurrences in the same kernel code and hopefully solve the
>> issue that is making it wedged.
>>
>> Dump the stack trace when a process fails to be oom reaped.
> 
> Yes, this is really helpful.

tsk would be a thread group leader, but the thread which got stuck is not
always a thread group leader. Maybe dump all threads in that thread group
without PF_EXITING (or something) ?

> 
>> Signed-off-by: David Rientjes <rientjes@google.com>
> 
> Acked-by: Michal Hocko <mhocko@suse.com>
> 
> Thanks!
> 
>> ---
>>  mm/oom_kill.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
>> --- a/mm/oom_kill.c
>> +++ b/mm/oom_kill.c
>> @@ -26,6 +26,7 @@
>>  #include <linux/sched/mm.h>
>>  #include <linux/sched/coredump.h>
>>  #include <linux/sched/task.h>
>> +#include <linux/sched/debug.h>
>>  #include <linux/swap.h>
>>  #include <linux/timex.h>
>>  #include <linux/jiffies.h>
>> @@ -620,6 +621,7 @@ static void oom_reap_task(struct task_struct *tsk)
>>  
>>  	pr_info("oom_reaper: unable to reap pid:%d (%s)\n",
>>  		task_pid_nr(tsk), tsk->comm);
>> +	sched_show_task(tsk);
>>  	debug_show_all_locks();
>>  
>>  done:
> 


  reply	other threads:[~2020-01-15  9:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14 23:20 [patch] mm, oom: dump stack of victim when reaping failed David Rientjes
2020-01-15  8:43 ` Michal Hocko
2020-01-15  9:18   ` Tetsuo Handa [this message]
2020-01-15 20:27     ` David Rientjes
2020-01-15 21:09       ` Tetsuo Handa
2020-01-16 21:05         ` David Rientjes

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=9a7cbbf0-4283-f932-e422-84b4fb42a055@I-love.SAKURA.ne.jp \
    --to=penguin-kernel@i-love.sakura.ne.jp \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --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).