public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Justin Mattock <justinmattock@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	gcc@gcc.gnu.org, David Rientjes <rientjes@cs.washington.edu>
Subject: Re: cc1plus invoked oom-killer: gfp_mask=0x280da, order=0, oom_adj=0
Date: Wed, 4 Nov 2009 07:28:26 -0800	[thread overview]
Message-ID: <20091104072826.8b2dfb73.akpm@linux-foundation.org> (raw)
In-Reply-To: <20091104182238.54CB.A69D9226@jp.fujitsu.com>

On Wed,  4 Nov 2009 18:32:16 +0900 (JST) KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:

> > It would help if the oom-killer were to print some information about
> > the oom-killed process's memory footprint.
> > 
> 
> 
> How about this?

looks good, thanks.

> ========
> Subject: [PATCH] oom: show vsz and rss information of the killed process
> 
> In typical oom anylysis scenario, we frequently want to know the killed
> process has memory leak or not at first step.
> This patch add vsz and rss information to oom log for helping its
> analysis. It save much times of debugging guys.
> 
> example:
> ===================================================================
> rsyslogd invoked oom-killer: gfp_mask=0x201da, order=0, oom_adj=0
> Pid: 1308, comm: rsyslogd Not tainted 2.6.32-rc6 #24
> Call Trace:
> [<ffffffff8132e35b>] ?_spin_unlock+0x2b/0x40
> [<ffffffff810f186e>] oom_kill_process+0xbe/0x2b0
> 
> (snip)
> 
> 492283 pages non-shared
> Out of memory: kill process 2341 (memhog) score 527276 or a child
> Killed process 2341 (memhog) vsz:1054552kB, anon-rss:970588kB, file-rss:4kB
> ===========================================================================
>                              ^
>                              |
>                             here
> ...
>
> +	if (verbose) {
> +		task_lock(p);

We need to be careful with which locks we take on the oom-killer path,
because it can be called by code which already holds locks.  But I
expect task_lock() will be OK.

> +		printk(KERN_ERR "Killed process %d (%s) "
> +		       "vsz:%lukB, anon-rss:%lukB, file-rss:%lukB\n",
> +		       task_pid_nr(p), p->comm,
> +		       K(p->mm->total_vm),
> +		       K(get_mm_counter(p->mm, anon_rss)),
> +		       K(get_mm_counter(p->mm, file_rss)));
> +		task_unlock(p);
> +	}


  reply	other threads:[~2009-11-04 15:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-02 21:29 cc1plus invoked oom-killer: gfp_mask=0x280da, order=0, oom_adj=0 Justin Mattock
2009-11-02 21:49 ` Jiri Slaby
2009-11-02 22:02   ` Justin Mattock
2009-11-02 22:05     ` Jiri Slaby
2009-11-02 22:12       ` Justin P. Mattock
2009-11-03  0:56       ` Justin P. Mattock
2009-11-04  1:18 ` KOSAKI Motohiro
2009-11-04  1:40   ` Justin P. Mattock
2009-11-04  6:24 ` Andrew Morton
2009-11-04  6:44   ` Justin P. Mattock
2009-11-04  9:14     ` Jiri Slaby
2009-11-04  9:32   ` KOSAKI Motohiro
2009-11-04 15:28     ` Andrew Morton [this message]
2009-11-04 23:20       ` KOSAKI Motohiro
2009-11-04 13:13   ` Dave Korn
2009-11-04 15:08     ` Justin P. Mattock
2009-11-04 15:45       ` Dave Korn
2009-11-04 16:39         ` Justin Mattock
2009-11-04 19:48           ` Dave Korn
2009-11-04 20:39             ` Justin P. Mattock
2009-11-04 21:22               ` Justin Mattock
2009-11-05  0:36                 ` Dave Korn
2009-11-05  3:36                   ` Justin Mattock
2009-11-05  5:08                     ` Dave Korn
2009-11-06 21:21                       ` Justin P. Mattock
2009-11-10  2:55                       ` Justin P. Mattock

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=20091104072826.8b2dfb73.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=gcc@gcc.gnu.org \
    --cc=justinmattock@gmail.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@cs.washington.edu \
    /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