linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Balbir Singh <balbir@linux.vnet.ibm.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Paul Menage <menage@google.com>,
	Pavel Emelianov <xemul@openvz.org>,
	Hugh Dickins <hugh@veritas.com>,
	Sudhir Kumar <skumar@linux.vnet.ibm.com>,
	YAMAMOTO Takashi <yamamoto@valinux.co.jp>,
	linux-kernel@vger.kernel.org, taka@valinux.co.jp,
	linux-mm@kvack.org, David Rientjes <rientjes@google.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [-mm] Add an owner to the mm_struct (v9)
Date: Fri, 11 Apr 2008 10:17:35 +0530	[thread overview]
Message-ID: <47FEED67.1080006@linux.vnet.ibm.com> (raw)
In-Reply-To: <20080411134739.1aae8bae.kamezawa.hiroyu@jp.fujitsu.com>

KAMEZAWA Hiroyuki wrote:
> On Fri, 11 Apr 2008 09:57:06 +0530
> Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> 
>> KAMEZAWA Hiroyuki wrote:
>>> maybe I don't undestand correctlly...
>>>
>>> On Thu, 10 Apr 2008 14:46:02 +0530
>>> Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>>>
>>>>  
>>>> +config MM_OWNER
>>>> +	bool
>>>> +
>>> no default is ok here  ? what value will this have if not selected ?
>>> I'm sorry if I misunderstand Kconfig.
>>>
>> The way this works is
>>
>> If I select memory resource controller, CONFIG_MM_OWNER is set to y, else it
>> does not even show up in the .config
>>
> ok, sorry for noise.
> 

No problem at all, please feel free to question anything.

>>>> +	/*
>>>> +	 * Search through everything else. We should not get
>>>> +	 * here often
>>>> +	 */
>>>> +	do_each_thread(g, c) {
>>>> +		if (c->mm == mm)
>>>> +			goto assign_new_owner;
>>>> +	} while_each_thread(g, c);
>>>> +
>>> Again, do_each_thread() is suitable here ?
>>> for_each_process() ?
>>>
>> do_each_thread(), while_each_thread() walks all processes and threads of those
>> processes in the system. It is a common pattern used in the kernel (see
>> try_to_freeze_tasks() or oom_kill_task() for example).
>>
> 
> What you want is finding a thread which has the "mm_struct". Why search all
> threads ? I think you only have to search processes(i.e. thread-group-leaders).
> 
> try_to_freeze_tasks()/oom_kill_task() have to chase all threads because
> it have to check flags in task_structs in a process.
> 

Good question. It is possible that clone() was called with CLONE_VM without
CLONE_THREAD. In which case we have threads sharing the VM without a thread
group leader. Please see zap_threads() for a similar search pattern.

-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL

--
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:[~2008-04-11  4:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-10  9:16 Balbir Singh
2008-04-11  3:33 ` KAMEZAWA Hiroyuki
2008-04-11  4:27   ` Balbir Singh
2008-04-11  4:47     ` KAMEZAWA Hiroyuki
2008-04-11  4:47       ` Balbir Singh [this message]
2008-04-11  4:58         ` KAMEZAWA Hiroyuki
2008-04-11  4:56           ` Balbir Singh
2008-04-15  1:31 ` KAMEZAWA Hiroyuki

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=47FEED67.1080006@linux.vnet.ibm.com \
    --to=balbir@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=hugh@veritas.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=menage@google.com \
    --cc=rientjes@google.com \
    --cc=skumar@linux.vnet.ibm.com \
    --cc=taka@valinux.co.jp \
    --cc=xemul@openvz.org \
    --cc=yamamoto@valinux.co.jp \
    /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