linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Christoph Lameter <clameter@sgi.com>,
	Andrea Arcangeli <andrea@suse.de>,
	linux-mm@kvack.org
Subject: Re: [patch] oom: add verbose_oom sysctl to dump tasklist
Date: Thu, 13 Sep 2007 16:03:17 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.0.9999.0709131556470.11367@chino.kir.corp.google.com> (raw)
In-Reply-To: <20070913152359.85949e0e.akpm@linux-foundation.org>

On Thu, 13 Sep 2007, Andrew Morton wrote:

> > Adds 'verbose_oom' sysctl to dump the tasklist and pertinent memory usage
> > information on an OOM killing.  Information included is pid, uid, tgid,
> > VM size, RSS, last cpu, oom_adj score, and name.
> 
> Would be useful to have some description of why this is needed, how we will
> use it to fix stuff, etc.  IOW: what value does it bring??
> 

I don't think we would use it to fix anything, I think the end user would 
use it to figure out why his or her system was OOM.

Obviously this is also possible to do from userspace, but with more 
trouble in collecting all the information presented here.

> And if it _is_ valuable, how come it's tunable offable?  I guess the
> tasklist dump will be pretty huge..
> 

As a courtesy to SGI and friends who already have enough trouble scanning 
the tasklist because of their super huge machines.

> We should be dumping more stuff at oom-time.  I thought we were dumping the
> sysrq-m-style output but that patch which did that got lost years ago.
> 

I've wondered about a notifier hook to userspace so if the user had 
specified an OOM handling script to be executed before the actual killer 
was invoked, you could collect this information on your own or anything 
else you found pertinent.

> > diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> > --- a/mm/oom_kill.c
> > +++ b/mm/oom_kill.c
> > @@ -27,6 +27,7 @@
> >  #include <linux/notifier.h>
> >  
> >  int sysctl_panic_on_oom;
> > +int sysctl_verbose_oom;
> >  /* #define DEBUG */
> >  
> >  unsigned long VM_is_OOM;
> > @@ -146,6 +147,29 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
> >  	return points;
> >  }
> >  
> > +static inline void dump_tasks(void)
> > +{
> > +	struct task_struct *g, *p;
> > +
> > +	printk(KERN_INFO "[ pid ]   uid  tgid total_vm      rss cpu oom_adj name\n");
> > +	do_each_thread(g, p) {
> > +		/*
> > +		 * total_vm and rss sizes do not exist for tasks with a
> > +		 * detached mm so there's no need to report them.  They are
> > +		 * not eligible for OOM killing anyway.
> > +		 */
> > +		if (!p->mm)
> > +			continue;
> > +
> > +		task_lock(p);
> > +		printk(KERN_INFO "[%5d] %5d %5d %8lu %8lu %3d     %3d %s\n",
> > +		       p->pid, p->uid, p->tgid, p->mm->total_vm,
> > +		       get_mm_rss(p->mm), (int)task_cpu(p), p->oomkilladj,
> > +		       p->comm);
> > +		task_unlock(p);
> > +	} while_each_thread(g, p);
> > +}
> 
> There's no need to inline this.
> 

Ah, gotcha.

> Also, it appears to be 100% generic and useful, so perhaps it should be put
> into kernel/something.c and made available to other code.  Probably there's
> already code out there which should be converted to a call to this
> function?
> 

I'll look into it, thanks for the review.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2007-09-13 23:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-07  8:17 David Rientjes
2007-09-13 22:23 ` Andrew Morton
2007-09-13 23:03   ` David Rientjes [this message]

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=alpine.DEB.0.9999.0709131556470.11367@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrea@suse.de \
    --cc=clameter@sgi.com \
    --cc=linux-mm@kvack.org \
    /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