[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100324070547.GB3308@balbir.in.ibm.com>
Date: Wed, 24 Mar 2010 12:35:48 +0530
From: Balbir Singh <balbir@...ux.vnet.ibm.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc: "linux-mm@...ck.org" <linux-mm@...ck.org>,
"nishimura@....nes.nec.co.jp" <nishimura@....nes.nec.co.jp>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
arighi@...eler.com
Subject: Re: [BUGFIX][PATCH] fix race in file_mapped accounting in memcg
* KAMEZAWA Hiroyuki <kamezawa.hiroyu@...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@...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@...ux.vnet.ibm.com>
--
Three Cheers,
Balbir
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists