Re: cc1plus invoked oom-killer: gfp_mask=0x280da, order=0,oom_adj=0

From: Andrew Morton
Date: Wed Nov 04 2009 - 10:29:11 EST


On Wed, 4 Nov 2009 18:32:16 +0900 (JST) KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx> 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);
> + }

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/