linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Minchan Kim <minchan.kim@gmail.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
	Oleg Nesterov <oleg@redhat.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Subject: Re: [PATCH] use find_lock_task_mm in memory cgroups oom v2
Date: Wed, 16 Jun 2010 13:51:09 +0900	[thread overview]
Message-ID: <20100616135109.75b21f7c.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <AANLkTikGcl8l8TvSWx2Ij7I5E-TVjGplRU5YfX0mTAG0@mail.gmail.com>

On Wed, 16 Jun 2010 10:12:20 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:

> On Wed, Jun 16, 2010 at 5:33 AM, KAMEZAWA Hiroyuki
> <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > On Tue, 15 Jun 2010 18:59:25 +0900
> > Minchan Kim <minchan.kim@gmail.com> wrote:
> >
> >> > -/*
> >> > +/**
> >> > + * find_lock_task_mm - Checking a process which a task belongs to has valid mm
> >> > + * and return a locked task which has a valid pointer to mm.
> >> > + *
> >>
> >> This comment should have been another patch.
> >> BTW, below comment uses "subthread" word.
> >> Personally it's easy to understand function's goal to me. :)
> >>
> >> How about following as?
> >> Checking a process which has any subthread with vaild mm
> >> ....
> >>
> > Sure. thank you. v2 is here. I removed unnecessary parts.
> >
> > ==
> > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> >
> > When the OOM killer scans task, it check a task is under memcg or
> > not when it's called via memcg's context.
> >
> > But, as Oleg pointed out, a thread group leader may have NULL ->mm
> > and task_in_mem_cgroup() may do wrong decision. We have to use
> > find_lock_task_mm() in memcg as generic OOM-Killer does.
> >
> > Changelog:
> > A - removed unnecessary changes in comments.
> >
> 
> mm->owner solves the same problem, but unfortunately we have task
> based selection in OOM killer, so we need this patch. It is quite
> ironic that we find the mm from the task and then eventually the task
> back from mm->owner and then the mem cgroup. If we already know the mm
> from oom_kill.c, I think we can change the function to work off of
> that. mm->owner->cgroup..no?
> 

There is no function as for_each_mm(). There is only for_each_process().

And, generally, there is no way to get a task via mm_struct.
To send signal etc. we need task.
(mm_owner is an option but not always configured and there will be
 complicated problem as vfork() etc.)

I think oom_kill.c has to depend on thread, not mm, unfortunately.


Thanks,
-Kame

--
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-06-16  4:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-15  6:24 [PATCH] use find_lock_task_mm in memory cgroups oom KAMEZAWA Hiroyuki
2010-06-15  9:59 ` Minchan Kim
2010-06-16  0:03   ` [PATCH] use find_lock_task_mm in memory cgroups oom v2 KAMEZAWA Hiroyuki
2010-06-16  4:42     ` Balbir Singh
2010-06-16  4:51       ` KAMEZAWA Hiroyuki [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=20100616135109.75b21f7c.kamezawa.hiroyu@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan.kim@gmail.com \
    --cc=nishimura@mxp.nes.nec.co.jp \
    --cc=oleg@redhat.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