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: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	arighi@develer.com
Subject: Re: [BUGFIX][PATCH] fix race in file_mapped accounting in memcg
Date: Wed, 24 Mar 2010 12:35:48 +0530	[thread overview]
Message-ID: <20100324070547.GB3308@balbir.in.ibm.com> (raw)
In-Reply-To: <20100324154324.6d27336e.kamezawa.hiroyu@jp.fujitsu.com>

* KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2010-03-24 15:43:24]:

> A fix for race in file_mapped statistics. I noticed this race while discussing
> Andrea's dirty accounting patch series. 
> At the end of discusstion, I said "please don't touch file mapped". So, this bugfix
> should be posted as an independent patch.
> Tested on the latest mmotm.
> 
> Thanks,
> -Kame
> 
> ==
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> Now, memcg's FILE_MAPPED accounting has following race with
> move_account (happens at rmdir()).
> 
>     increment page->mapcount (rmap.c)
>     mem_cgroup_update_file_mapped()           move_account()
> 					      lock_page_cgroup()
> 					      check page_mapped() if
> 					      page_mapped(page)>1 {
> 						FILE_MAPPED -1 from old memcg
> 						FILE_MAPPED +1 to old memcg
> 					      }
> 					      .....
> 					      overwrite pc->mem_cgroup
> 					      unlock_page_cgroup()
>     lock_page_cgroup()
>     FILE_MAPPED + 1 to pc->mem_cgroup
>     unlock_page_cgroup()
> 
> Then,
> 	old memcg (-1 file mapped)
> 	new memcg (+2 file mapped)
>

Good catch!


Reviewed-by: Balbir Singh <balbir@linux.vnet.ibm.com>
 
 
-- 
	Three Cheers,
	Balbir

--
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-03-24  7:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-24  6:43 KAMEZAWA Hiroyuki
2010-03-24  7:05 ` Balbir Singh [this message]
2010-03-24  7:17 ` Daisuke Nishimura

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=20100324070547.GB3308@balbir.in.ibm.com \
    --to=balbir@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=arighi@develer.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nishimura@mxp.nes.nec.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