Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936760Ab3DICzg (ORCPT ); Mon, 8 Apr 2013 22:55:36 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:41922 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934461Ab3DICzf (ORCPT ); Mon, 8 Apr 2013 22:55:35 -0400 X-SecurityPolicyCheck: OK by SHieldMailChecker v1.8.4 Message-ID: <51638311.8030707@jp.fujitsu.com> Date: Tue, 09 Apr 2013 11:55:13 +0900 From: Kamezawa Hiroyuki User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Li Zefan CC: Andrew Morton , Tejun Heo , Glauber Costa , Johannes Weiner , LKML , Cgroups , linux-mm@kvack.org 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: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1071 Lines: 28 (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 from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/