Linux Container Development
 help / color / mirror / Atom feed
From: Balbir Singh <balbir-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: Paul Menage <menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: "yamamoto-jCdQPDEk3idL9jVzuh4AOg@public.gmane.org"
	<yamamoto-jCdQPDEk3idL9jVzuh4AOg@public.gmane.org>,
	"nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org"
	<nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org>,
	"linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org"
	<linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>,
	"containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org"
	<containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>,
	"xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org"
	<xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
Subject: Re: [RFD][PATCH] memcg: Move Usage at Task Move
Date: Wed, 11 Jun 2008 13:57:34 +0530	[thread overview]
Message-ID: <484F8C76.4080300@linux.vnet.ibm.com> (raw)
In-Reply-To: <6599ad830806110017t5ebeda78id1914d179a018422-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Paul Menage wrote:
> On Thu, Jun 5, 2008 at 6:52 PM, KAMEZAWA Hiroyuki
> <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org> wrote:
>> Move Usage at Task Move (just an experimantal for discussion)
>> I tested this but don't think bug-free.
>>
>> In current memcg, when task moves to a new cg, the usage remains in the old cg.
>> This is considered to be not good.
> 
> Is it really such a big deal if we don't transfer the page ownerships
> to the new cgroup? As this thread has shown, it's a fairly painful
> operation to support. It would be good to have some concrete examples
> of cases where this is needed.
> 
> 

I tend to agree with Paul. One of the reasons, I did not move charges is that
makes migration an expensive operation. Since migration is well controlled with
permissions, we assume that the node owner what he/she is doing.

>> This is a trial to move "usage" from old cg to new cg at task move.
>> Finally, you'll see the problems we have to handle are failure and rollback.
>>
>> This one's Basic algorithm is
>>
>>     0. can_attach() is called.
>>     1. count movable pages by scanning page table. isolate all pages from LRU.
>>     2. try to create enough room in new memory cgroup
>>     3. start moving page accouing
>>     4. putback pages to LRU.
>>     5. can_attach() for other cgroups are called.
>>
>> A case study.
>>
>>  group_A -> limit=1G, task_X's usage= 800M.
>>  group_B -> limit=1G, usage=500M.
>>
>> For moving task_X from group_A to group_B.
>>  - group_B  should be reclaimed or have enough room.
>>
>> While moving task_X from group_A to group_B.
>>  - group_B's memory usage can be changed
>>  - group_A's memory usage can be changed
>>
>>  We accounts the resouce based on pages. Then, we can't move all resource
>>  usage at once.
>>
>>  If group_B has no more room when we've moved 700M of task_X to group_B,
>>  we have to move 700M of task_X back to group_A. So I implemented roll-back.
>>  But other process may use up group_A's available resource at that point.
>>
>>  For avoiding that, preserve 800M in group_B before moving task_X means that
>>  task_X can occupy 1600M of resource at moving. (So I don't do in this patch.)
> 
> I think that pre-reserving in B would be the cleanest solution, and
> would save the need to provide rollback.
> 
>>  2. Don't move any usage at task move. (current implementation.)
>>    Pros.
>>      - no complication in the code.
>>    Cons.
>>      - A task's usage is chareged to wrong cgroup.
>>      - Not sure, but I believe the users don't want this.
> 
> I'd say stick with this unless there a strong arguments in favour of
> changing, based on concrete needs.
> 
>> One reasone is that I think a typical usage of memory controller is
>> fork()->move->exec(). (by libcg ?) and exec() will flush the all usage.
> 
> Exactly - this is a good reason *not* to implement move - because then
> you drag all the usage of the middleware daemon into the new cgroup.
> 

Yes. The other thing is that charges will eventually fade away. Please see the
cgroup implementation of page_referenced() and mark_page_accessed(). The
original group on memory pressure will drop pages that were left behind by a
task that migrates. The new group will pick it up if referenced.

[snip]

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

  parent reply	other threads:[~2008-06-11  8:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-06  1:52 [RFD][PATCH] memcg: Move Usage at Task Move KAMEZAWA Hiroyuki
     [not found] ` <20080606105235.3c94daaf.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-06-10  5:50   ` YAMAMOTO Takashi
     [not found]     ` <20080610055032.A8AB25A0E-Pcsii4f/SVk@public.gmane.org>
2008-06-10  8:13       ` KAMEZAWA Hiroyuki
     [not found]         ` <20080610171348.fb7aa360.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-06-10 12:57           ` YAMAMOTO Takashi
     [not found]             ` <20080610125703.9E6CE5A11-Pcsii4f/SVk@public.gmane.org>
2008-06-11  2:02               ` KAMEZAWA Hiroyuki
     [not found]                 ` <20080611110216.504faf15.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-06-11  3:45                   ` YAMAMOTO Takashi
     [not found]                     ` <20080611034514.D482F5A11-Pcsii4f/SVk@public.gmane.org>
2008-06-11  4:08                       ` KAMEZAWA Hiroyuki
2008-06-10  7:35   ` Daisuke Nishimura
     [not found]     ` <20080610163550.65c97f6a.nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org>
2008-06-10  8:26       ` KAMEZAWA Hiroyuki
     [not found]         ` <20080610172637.39ffff5c.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-06-11  3:03           ` Daisuke Nishimura
     [not found]             ` <20080611120345.07ddadc6.nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org>
2008-06-11  3:25               ` KAMEZAWA Hiroyuki
     [not found]                 ` <20080611122500.677757c6.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-06-11  3:44                   ` YAMAMOTO Takashi
     [not found]                     ` <20080611034446.4C5535A23-Pcsii4f/SVk@public.gmane.org>
2008-06-11  4:14                       ` KAMEZAWA Hiroyuki
     [not found]                         ` <20080611131437.76961fc3.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-06-11  4:29                           ` Daisuke Nishimura
     [not found]                             ` <20080611132909.2eb38039.nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org>
2008-06-11  4:40                               ` KAMEZAWA Hiroyuki
2008-06-12  5:20                           ` YAMAMOTO Takashi
     [not found]                             ` <20080612052033.ED6FD5A0D-Pcsii4f/SVk@public.gmane.org>
2008-06-12  6:51                               ` KAMEZAWA Hiroyuki
2008-06-11  7:17   ` Paul Menage
     [not found]     ` <6599ad830806110017t5ebeda78id1914d179a018422-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-06-11  7:45       ` KAMEZAWA Hiroyuki
     [not found]         ` <20080611164544.94047336.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-06-11  8:04           ` Paul Menage
     [not found]             ` <6599ad830806110104n99cdc7h80063e91d16bf0a5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-06-11  8:27               ` KAMEZAWA Hiroyuki
     [not found]                 ` <20080611172714.018aa68c.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-06-11  8:48                   ` Paul Menage
     [not found]                     ` <6599ad830806110148v65df67f8ge0ccdd56c21c89e0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-06-12  5:08                       ` KAMEZAWA Hiroyuki
     [not found]                         ` <20080612140806.dc161c77.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-06-12 13:17                           ` Serge E. Hallyn
     [not found]                         ` <20080612131748.GB8453-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-06-12 13:34                           ` kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A
     [not found]                             ` <27043861.1213277688814.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-06-12 21:08                               ` Serge E. Hallyn
     [not found]                                 ` <20080612210812.GA22948-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-06-13  0:34                                   ` KAMEZAWA Hiroyuki
     [not found]                                     ` <20080613093436.ca1a6ded.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-06-13  0:41                                       ` KAMEZAWA Hiroyuki
2008-06-11  8:27       ` Balbir Singh [this message]
     [not found]         ` <484F8C76.4080300-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2008-06-11 12:21           ` Daisuke Nishimura
     [not found]         ` <20080611212126.317a95f7.d-nishimura-1T/T2zRcyZr+G+EEi5ephHgSJqDPrsil@public.gmane.org>
2008-06-11 12:51           ` kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A
     [not found]             ` <22652920.1213188663353.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2008-06-11 13:13               ` Balbir Singh

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=484F8C76.4080300@linux.vnet.ibm.com \
    --to=balbir-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org \
    --cc=xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org \
    --cc=yamamoto-jCdQPDEk3idL9jVzuh4AOg@public.gmane.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