From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kamezawa Hiroyuki Subject: Re: [PATCH] memcg: take reference before releasing rcu_read_lock Date: Mon, 01 Apr 2013 14:03:26 +0900 Message-ID: <5159151E.9070204@jp.fujitsu.com> References: <51556CE9.9060000@huawei.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <51556CE9.9060000-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" To: Li Zefan Cc: Glauber Costa , Michal Hocko , Johannes Weiner , LKML , Cgroups , linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, Andrew Morton (2013/03/29 19:28), Li Zefan wrote: > The memcg is not referenced, so it can be destroyed at anytime right > after we exit rcu read section, so it's not safe to access it. > > To fix this, we call css_tryget() to get a reference while we're still > in rcu read section. > > This also removes a bogus comment above __memcg_create_cache_enqueue(). > > Signed-off-by: Li Zefan Acked-by: KAMEZAWA Hiroyuki From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx152.postini.com [74.125.245.152]) by kanga.kvack.org (Postfix) with SMTP id AACD76B0002 for ; Mon, 1 Apr 2013 01:03:50 -0400 (EDT) Received: from m1.gw.fujitsu.co.jp (unknown [10.0.50.71]) by fgwmail5.fujitsu.co.jp (Postfix) with ESMTP id CF35D3EE0C1 for ; Mon, 1 Apr 2013 14:03:48 +0900 (JST) Received: from smail (m1 [127.0.0.1]) by outgoing.m1.gw.fujitsu.co.jp (Postfix) with ESMTP id B5A5D45DE5C for ; Mon, 1 Apr 2013 14:03:48 +0900 (JST) Received: from s1.gw.fujitsu.co.jp (s1.gw.fujitsu.co.jp [10.0.50.91]) by m1.gw.fujitsu.co.jp (Postfix) with ESMTP id 9E43945DE5A for ; Mon, 1 Apr 2013 14:03:48 +0900 (JST) Received: from s1.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s1.gw.fujitsu.co.jp (Postfix) with ESMTP id 8BF121DB8047 for ; Mon, 1 Apr 2013 14:03:48 +0900 (JST) Received: from ml14.s.css.fujitsu.com (ml14.s.css.fujitsu.com [10.240.81.134]) by s1.gw.fujitsu.co.jp (Postfix) with ESMTP id 434C11DB8042 for ; Mon, 1 Apr 2013 14:03:48 +0900 (JST) Message-ID: <5159151E.9070204@jp.fujitsu.com> Date: Mon, 01 Apr 2013 14:03:26 +0900 From: Kamezawa Hiroyuki MIME-Version: 1.0 Subject: Re: [PATCH] memcg: take reference before releasing rcu_read_lock References: <51556CE9.9060000@huawei.com> In-Reply-To: <51556CE9.9060000@huawei.com> Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Li Zefan Cc: Glauber Costa , Michal Hocko , Johannes Weiner , LKML , Cgroups , linux-mm@kvack.org, Andrew Morton (2013/03/29 19:28), Li Zefan wrote: > The memcg is not referenced, so it can be destroyed at anytime right > after we exit rcu read section, so it's not safe to access it. > > To fix this, we call css_tryget() to get a reference while we're still > in rcu read section. > > This also removes a bogus comment above __memcg_create_cache_enqueue(). > > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757097Ab3DAFDv (ORCPT ); Mon, 1 Apr 2013 01:03:51 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:51327 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757063Ab3DAFDu (ORCPT ); Mon, 1 Apr 2013 01:03:50 -0400 X-SecurityPolicyCheck: OK by SHieldMailChecker v1.8.4 Message-ID: <5159151E.9070204@jp.fujitsu.com> Date: Mon, 01 Apr 2013 14:03:26 +0900 From: Kamezawa Hiroyuki User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 To: Li Zefan CC: Glauber Costa , Michal Hocko , Johannes Weiner , LKML , Cgroups , linux-mm@kvack.org, Andrew Morton Subject: Re: [PATCH] memcg: take reference before releasing rcu_read_lock References: <51556CE9.9060000@huawei.com> In-Reply-To: <51556CE9.9060000@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 (2013/03/29 19:28), Li Zefan wrote: > The memcg is not referenced, so it can be destroyed at anytime right > after we exit rcu read section, so it's not safe to access it. > > To fix this, we call css_tryget() to get a reference while we're still > in rcu read section. > > This also removes a bogus comment above __memcg_create_cache_enqueue(). > > Signed-off-by: Li Zefan Acked-by: KAMEZAWA Hiroyuki