lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 26 Jun 2009 10:18:03 +0530
From:	Balbir Singh <balbir@...ux.vnet.ibm.com>
To:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	kamezawa.hiroyuki@...fujitsu.com, nishimura@....nes.nec.co.jp,
	lizf@...fujitsu.com, menage@...gle.com, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] memcg: add commens for expaing memory barrier (Was Re:
	Low overhead patches for the memory cgroup controller (v5)

* KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> [2009-06-26 09:57:45]:

> On Tue, 23 Jun 2009 09:01:16 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@...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@...fujitsu.com>
> 
> Add comments for the reason of smp_wmb() in mem_cgroup_commit_charge().
> 
> Cc: Daisuke Nishimura <nishimura@....nes.nec.co.jp>
> Cc: Balbir Singh <balbir@...ux.vnet.ibm.com>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...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 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

Powered by Openwall GNU/*/Linux Powered by OpenVZ