linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Rik van Riel <riel@redhat.com>,
	linux-mm@kvack.org
Subject: Re: [patch 2/2] oom: kill all threads sharing oom killed task's mm
Date: Mon, 16 Aug 2010 08:00:49 +0200	[thread overview]
Message-ID: <20100816060049.GB9498@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1008151425271.8727@chino.kir.corp.google.com>

On 08/15, David Rientjes wrote:
>
> On Sun, 15 Aug 2010, Oleg Nesterov wrote:
>
> > Again, I do not know how the code looks without the patch, but
>
> Why not?  This series is based on Linus' tree.

OK, thanks...

> > > +	do_each_thread(g, q) {
> > > +		if (q->mm == mm && !same_thread_group(q, p))
> > > +			force_sig(SIGKILL, q);
> > > +	} while_each_thread(g, q);
> >
> > We can kill the wrong task. "q->mm == mm" doesn't necessarily mean
> > we found the task which shares ->mm with p (see above).
> >
> > This needs atomic_inc(mm_users). And please do not use do_each_thread.
>
> Instead of using mm_users to pin the mm, we could simply do this iteration
> with for_each_process() before sending the SIGKILL to p.

Yes, this should work too. (I'd prefer to not take ->siglock under
task->alloc_lock, but currently this is correct and happens anyway).

Oleg.

--
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:[~2010-08-16  6:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-15  4:30 [patch 1/2] oom: avoid killing a task if a thread sharing its mm cannot be killed David Rientjes
2010-08-15  4:31 ` [patch 2/2] oom: kill all threads sharing oom killed task's mm David Rientjes
2010-08-15 15:45   ` Oleg Nesterov
2010-08-15 21:28     ` David Rientjes
2010-08-16  6:00       ` Oleg Nesterov [this message]
2010-08-15 15:18 ` [patch 1/2] oom: avoid killing a task if a thread sharing its mm cannot be killed Oleg Nesterov
2010-08-15 21:23   ` David Rientjes
2010-08-16  5:52     ` Oleg Nesterov
2010-08-16 10:56       ` 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=20100816060049.GB9498@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=riel@redhat.com \
    --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).