From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx173.postini.com [74.125.245.173]) by kanga.kvack.org (Postfix) with SMTP id 709336B0005 for ; Mon, 8 Apr 2013 22:55:35 -0400 (EDT) Received: from m4.gw.fujitsu.co.jp (unknown [10.0.50.74]) by fgwmail6.fujitsu.co.jp (Postfix) with ESMTP id 166363EE0C0 for ; Tue, 9 Apr 2013 11:55:33 +0900 (JST) Received: from smail (m4 [127.0.0.1]) by outgoing.m4.gw.fujitsu.co.jp (Postfix) with ESMTP id F346945DE52 for ; Tue, 9 Apr 2013 11:55:32 +0900 (JST) Received: from s4.gw.fujitsu.co.jp (s4.gw.fujitsu.co.jp [10.0.50.94]) by m4.gw.fujitsu.co.jp (Postfix) with ESMTP id DB0E645DE4F for ; Tue, 9 Apr 2013 11:55:32 +0900 (JST) Received: from s4.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s4.gw.fujitsu.co.jp (Postfix) with ESMTP id CC4741DB803E for ; Tue, 9 Apr 2013 11:55:32 +0900 (JST) Received: from m1000.s.css.fujitsu.com (m1000.s.css.fujitsu.com [10.240.81.136]) by s4.gw.fujitsu.co.jp (Postfix) with ESMTP id 81F8B1DB8037 for ; Tue, 9 Apr 2013 11:55:32 +0900 (JST) Message-ID: <51638311.8030707@jp.fujitsu.com> Date: Tue, 09 Apr 2013 11:55:13 +0900 From: Kamezawa Hiroyuki MIME-Version: 1.0 Subject: Re: [PATCH 07/12] memcg: use css_get/put when charging/uncharging kmem References: <5162648B.9070802@huawei.com> <516264FB.7030306@huawei.com> In-Reply-To: <516264FB.7030306@huawei.com> Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Li Zefan Cc: Andrew Morton , Tejun Heo , Glauber Costa , Johannes Weiner , LKML , Cgroups , linux-mm@kvack.org (2013/04/08 15:34), Li Zefan wrote: > Use css_get/put instead of mem_cgroup_get/put. > > We can't do a simple replacement, because here mem_cgroup_put() > is called during mem_cgroup_css_free(), while mem_cgroup_css_free() > won't be called until css refcnt goes down to 0. > > Instead we increment css refcnt in mem_cgroup_css_offline(), and > then check if there's still kmem charges. If not, css refcnt will > be decremented immediately, otherwise the refcnt won't be decremented > when kmem charges goes down to 0. > > v2: > - added wmb() in kmem_cgroup_css_offline(), pointed out by Michal > - revised comments as suggested by Michal > - fixed to check if kmem is activated in kmem_cgroup_css_offline() > > Signed-off-by: Li Zefan Acked-by: KAMEZAWA Hiroyuki -- 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: email@kvack.org