public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Righi <righi.andrea@gmail.com>
To: Dave Hansen <dave@linux.vnet.ibm.com>
Cc: balbir@linux.vnet.ibm.com, linux-kernel@vger.kernel.org,
	kosaki.motohiro@jp.fujitsu.com, containers@lists.osdl.org,
	menage@google.com, xemul@openvz.org
Subject: Re: [RFC PATCH 5/5] refresh VM committed space after a task migration
Date: Wed, 11 Jun 2008 12:37:57 +0200 (MEST)	[thread overview]
Message-ID: <484FAB04.2010800@gmail.com> (raw)
In-Reply-To: <1213119688.13882.13.camel@nimitz>

Dave Hansen wrote:
> On Tue, 2008-06-10 at 01:33 +0200, Andrea Righi wrote:
>> +       preempt_disable();
>> +       committed = atomic_long_read(&p->vm_committed_space);
>> +       atomic_long_sub(committed, &old_mem->vmacct.vm_committed_space);
>> +       atomic_long_add(committed, &mem->vmacct.vm_committed_space);
>> +       preempt_enable();
>>  out:
>>         mmput(mm);
>>  }
> 
> Why bother with the preempt stuff here?  What does the actually protect
> against?  I assume that you're trying to keep other tasks that might run
> on this CPU from seeing weird, inconsistent numbers in here.  Is there
> some other looks that keeps *other* cpus from seeing this?
> 
> In any case, I think it needs a big, fat comment.

Yes, true, mem_cgroup_move_task() is called after the task->cgroups
pointer has been changed. So, even if task changes its committed space
between the atomic_long_sub() and atomic_long_add() it will be correctly
accounted in the new cgroup.

-Andrea

      reply	other threads:[~2008-06-11 10:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-09 23:33 [RFC PATCH 5/5] refresh VM committed space after a task migration Andrea Righi
2008-06-10 17:41 ` Dave Hansen
2008-06-11 10:37   ` Andrea Righi [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=484FAB04.2010800@gmail.com \
    --to=righi.andrea@gmail.com \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=containers@lists.osdl.org \
    --cc=dave@linux.vnet.ibm.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=menage@google.com \
    --cc=xemul@openvz.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