From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759721Ab2EPH5x (ORCPT ); Wed, 16 May 2012 03:57:53 -0400 Received: from fgwmail6.fujitsu.co.jp ([192.51.44.36]:40053 "EHLO fgwmail6.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759668Ab2EPH5v (ORCPT ); Wed, 16 May 2012 03:57:51 -0400 X-SecurityPolicyCheck: OK by SHieldMailChecker v1.7.4 Message-ID: <4FB35D85.5070304@jp.fujitsu.com> Date: Wed, 16 May 2012 16:55:49 +0900 From: KAMEZAWA Hiroyuki User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Glauber Costa CC: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Tejun Heo , Li Zefan , Greg Thelen , Suleiman Souhlal , Michal Hocko , Johannes Weiner , devel@openvz.org, Christoph Lameter , Pekka Enberg Subject: Re: [PATCH v2 19/29] skip memcg kmem allocations in specified code regions References: <1336758272-24284-1-git-send-email-glommer@parallels.com> <1336758272-24284-20-git-send-email-glommer@parallels.com> <4FB1C398.1010000@jp.fujitsu.com> <4FB346E3.5060507@parallels.com> In-Reply-To: <4FB346E3.5060507@parallels.com> Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (2012/05/16 15:19), Glauber Costa wrote: > On 05/15/2012 06:46 AM, KAMEZAWA Hiroyuki wrote: >> (2012/05/12 2:44), Glauber Costa wrote: >> >>> This patch creates a mechanism that skip memcg allocations during >>> certain pieces of our core code. It basically works in the same way >>> as preempt_disable()/preempt_enable(): By marking a region under >>> which all allocations will be accounted to the root memcg. >>> >>> We need this to prevent races in early cache creation, when we >>> allocate data using caches that are not necessarily created already. >>> >>> Signed-off-by: Glauber Costa >>> CC: Christoph Lameter >>> CC: Pekka Enberg >>> CC: Michal Hocko >>> CC: Kamezawa Hiroyuki >>> CC: Johannes Weiner >>> CC: Suleiman Souhlal >> >> >> The concept seems okay to me but... >> >>> --- >>> include/linux/sched.h | 1 + >>> mm/memcontrol.c | 25 +++++++++++++++++++++++++ >>> 2 files changed, 26 insertions(+), 0 deletions(-) >>> >>> diff --git a/include/linux/sched.h b/include/linux/sched.h >>> index 81a173c..0501114 100644 >>> --- a/include/linux/sched.h >>> +++ b/include/linux/sched.h >>> @@ -1613,6 +1613,7 @@ struct task_struct { >>> unsigned long nr_pages; /* uncharged usage */ >>> unsigned long memsw_nr_pages; /* uncharged mem+swap usage */ >>> } memcg_batch; >>> + atomic_t memcg_kmem_skip_account; >> >> >> If only 'current' thread touch this, you don't need to make this atomic counter. >> you can use 'long'. >> > You're absolutely right, Kame, thanks. > I first used atomic_t because I had it tested against current->mm->owner. > > Do you, btw, agree to use current instead of owner here? > You can find the rationale in earlier mails between me and Suleiman. I agree to use current. This information depends on the context of callers. Thanks, -Kame From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx122.postini.com [74.125.245.122]) by kanga.kvack.org (Postfix) with SMTP id 9FA3A6B004D for ; Wed, 16 May 2012 03:57:51 -0400 (EDT) Received: from m1.gw.fujitsu.co.jp (unknown [10.0.50.71]) by fgwmail6.fujitsu.co.jp (Postfix) with ESMTP id 9A3E63EE0C3 for ; Wed, 16 May 2012 16:57:49 +0900 (JST) Received: from smail (m1 [127.0.0.1]) by outgoing.m1.gw.fujitsu.co.jp (Postfix) with ESMTP id 7767545DE61 for ; Wed, 16 May 2012 16:57:49 +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 4C9BC45DE5B for ; Wed, 16 May 2012 16:57:49 +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 37F60E08004 for ; Wed, 16 May 2012 16:57:49 +0900 (JST) Received: from m107.s.css.fujitsu.com (m107.s.css.fujitsu.com [10.240.81.147]) by s1.gw.fujitsu.co.jp (Postfix) with ESMTP id E1A3F1DB804E for ; Wed, 16 May 2012 16:57:48 +0900 (JST) Message-ID: <4FB35D85.5070304@jp.fujitsu.com> Date: Wed, 16 May 2012 16:55:49 +0900 From: KAMEZAWA Hiroyuki MIME-Version: 1.0 Subject: Re: [PATCH v2 19/29] skip memcg kmem allocations in specified code regions References: <1336758272-24284-1-git-send-email-glommer@parallels.com> <1336758272-24284-20-git-send-email-glommer@parallels.com> <4FB1C398.1010000@jp.fujitsu.com> <4FB346E3.5060507@parallels.com> In-Reply-To: <4FB346E3.5060507@parallels.com> Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Glauber Costa Cc: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Tejun Heo , Li Zefan , Greg Thelen , Suleiman Souhlal , Michal Hocko , Johannes Weiner , devel@openvz.org, Christoph Lameter , Pekka Enberg (2012/05/16 15:19), Glauber Costa wrote: > On 05/15/2012 06:46 AM, KAMEZAWA Hiroyuki wrote: >> (2012/05/12 2:44), Glauber Costa wrote: >> >>> This patch creates a mechanism that skip memcg allocations during >>> certain pieces of our core code. It basically works in the same way >>> as preempt_disable()/preempt_enable(): By marking a region under >>> which all allocations will be accounted to the root memcg. >>> >>> We need this to prevent races in early cache creation, when we >>> allocate data using caches that are not necessarily created already. >>> >>> Signed-off-by: Glauber Costa >>> CC: Christoph Lameter >>> CC: Pekka Enberg >>> CC: Michal Hocko >>> CC: Kamezawa Hiroyuki >>> CC: Johannes Weiner >>> CC: Suleiman Souhlal >> >> >> The concept seems okay to me but... >> >>> --- >>> include/linux/sched.h | 1 + >>> mm/memcontrol.c | 25 +++++++++++++++++++++++++ >>> 2 files changed, 26 insertions(+), 0 deletions(-) >>> >>> diff --git a/include/linux/sched.h b/include/linux/sched.h >>> index 81a173c..0501114 100644 >>> --- a/include/linux/sched.h >>> +++ b/include/linux/sched.h >>> @@ -1613,6 +1613,7 @@ struct task_struct { >>> unsigned long nr_pages; /* uncharged usage */ >>> unsigned long memsw_nr_pages; /* uncharged mem+swap usage */ >>> } memcg_batch; >>> + atomic_t memcg_kmem_skip_account; >> >> >> If only 'current' thread touch this, you don't need to make this atomic counter. >> you can use 'long'. >> > You're absolutely right, Kame, thanks. > I first used atomic_t because I had it tested against current->mm->owner. > > Do you, btw, agree to use current instead of owner here? > You can find the rationale in earlier mails between me and Suleiman. I agree to use current. This information depends on the context of callers. Thanks, -Kame -- 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/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 From: KAMEZAWA Hiroyuki Subject: Re: [PATCH v2 19/29] skip memcg kmem allocations in specified code regions Date: Wed, 16 May 2012 16:55:49 +0900 Message-ID: <4FB35D85.5070304@jp.fujitsu.com> References: <1336758272-24284-1-git-send-email-glommer@parallels.com> <1336758272-24284-20-git-send-email-glommer@parallels.com> <4FB1C398.1010000@jp.fujitsu.com> <4FB346E3.5060507@parallels.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4FB346E3.5060507-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" To: Glauber Costa Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, Tejun Heo , Li Zefan , Greg Thelen , Suleiman Souhlal , Michal Hocko , Johannes Weiner , devel-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org, Christoph Lameter , Pekka Enberg (2012/05/16 15:19), Glauber Costa wrote: > On 05/15/2012 06:46 AM, KAMEZAWA Hiroyuki wrote: >> (2012/05/12 2:44), Glauber Costa wrote: >> >>> This patch creates a mechanism that skip memcg allocations during >>> certain pieces of our core code. It basically works in the same way >>> as preempt_disable()/preempt_enable(): By marking a region under >>> which all allocations will be accounted to the root memcg. >>> >>> We need this to prevent races in early cache creation, when we >>> allocate data using caches that are not necessarily created already. >>> >>> Signed-off-by: Glauber Costa >>> CC: Christoph Lameter >>> CC: Pekka Enberg >>> CC: Michal Hocko >>> CC: Kamezawa Hiroyuki >>> CC: Johannes Weiner >>> CC: Suleiman Souhlal >> >> >> The concept seems okay to me but... >> >>> --- >>> include/linux/sched.h | 1 + >>> mm/memcontrol.c | 25 +++++++++++++++++++++++++ >>> 2 files changed, 26 insertions(+), 0 deletions(-) >>> >>> diff --git a/include/linux/sched.h b/include/linux/sched.h >>> index 81a173c..0501114 100644 >>> --- a/include/linux/sched.h >>> +++ b/include/linux/sched.h >>> @@ -1613,6 +1613,7 @@ struct task_struct { >>> unsigned long nr_pages; /* uncharged usage */ >>> unsigned long memsw_nr_pages; /* uncharged mem+swap usage */ >>> } memcg_batch; >>> + atomic_t memcg_kmem_skip_account; >> >> >> If only 'current' thread touch this, you don't need to make this atomic counter. >> you can use 'long'. >> > You're absolutely right, Kame, thanks. > I first used atomic_t because I had it tested against current->mm->owner. > > Do you, btw, agree to use current instead of owner here? > You can find the rationale in earlier mails between me and Suleiman. I agree to use current. This information depends on the context of callers. Thanks, -Kame