From: Balbir Singh <balbir@linux.vnet.ibm.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
kamezawa.hiroyuki@jp.fujitsu.com, nishimura@mxp.nes.nec.co.jp,
lizf@cn.fujitsu.com, menage@google.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] memcg: add commens for expaing memory barrier (Was Re: Low overhead patches for the memory cgroup controller (v5)
Date: Fri, 26 Jun 2009 10:18:03 +0530 [thread overview]
Message-ID: <20090626044803.GG8642@balbir.in.ibm.com> (raw)
In-Reply-To: <20090626095745.01cef410.kamezawa.hiroyu@jp.fujitsu.com>
* KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2009-06-26 09:57:45]:
> On Tue, 23 Jun 2009 09:01:16 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > > Do we still need the smp_wmb()?
> > >
> > > It's hard to say, because we forgot to document it :(
> > >
> > Sorry for lack of documentation.
> >
> > pc->mem_cgroup should be visible before SetPageCgroupUsed(). Othrewise,
> > A routine believes USED bit will see bad pc->mem_cgroup.
> >
> > I'd like to add a comment later (againt new mmotm.)
> >
>
> Ok, it's now.
> ==
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>
> Add comments for the reason of smp_wmb() in mem_cgroup_commit_charge().
>
> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
> Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> ---
> mm/memcontrol.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> Index: mmotm-2.6.31-Jun25/mm/memcontrol.c
> ===================================================================
> --- mmotm-2.6.31-Jun25.orig/mm/memcontrol.c
> +++ mmotm-2.6.31-Jun25/mm/memcontrol.c
> @@ -1134,6 +1134,13 @@ static void __mem_cgroup_commit_charge(s
> }
>
> pc->mem_cgroup = mem;
> + /*
> + * We access a page_cgroup asynchronously without lock_page_cgroup().
> + * Especially when a page_cgroup is taken from a page, pc->mem_cgroup
> + * is accessed after testing USED bit. To make pc->mem_cgroup visible
> + * before USED bit, we need memory barrier here.
> + * See mem_cgroup_add_lru_list(), etc.
> + */
I don't think this is sufficient, since in
mem_cgroup_get_reclaim_stat_from_page() we say we need this since we
set used bit without atomic operation. The used bit is now atomically
set. I think we need to reword other comments as well.
--
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>
next prev parent reply other threads:[~2009-06-26 12:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-15 4:39 Low overhead patches for the memory cgroup controller (v5) Balbir Singh
2009-06-15 4:41 ` Balbir Singh
2009-06-15 8:20 ` KAMEZAWA Hiroyuki
2009-06-22 22:43 ` Andrew Morton
2009-06-23 0:01 ` KAMEZAWA Hiroyuki
2009-06-23 4:53 ` Balbir Singh
2009-06-26 0:57 ` [PATCH] memcg: add commens for expaing memory barrier (Was " KAMEZAWA Hiroyuki
2009-06-26 4:48 ` Balbir Singh [this message]
2009-06-28 23:32 ` 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=20090626044803.GG8642@balbir.in.ibm.com \
--to=balbir@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kamezawa.hiroyuki@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizf@cn.fujitsu.com \
--cc=menage@google.com \
--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;
as well as URLs for NNTP newsgroup(s).