From mboxrd@z Thu Jan 1 00:00:00 1970 From: Glauber Costa Subject: Re: [PATCH v5 04/14] kmem accounting basic infrastructure Date: Thu, 18 Oct 2012 21:03:23 +0400 Message-ID: <5080365B.3000506@parallels.com> References: <1350382611-20579-1-git-send-email-glommer@parallels.com> <1350382611-20579-5-git-send-email-glommer@parallels.com> <20121017151207.e8bb3db2.akpm@linux-foundation.org> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20121017151207.e8bb3db2.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" To: Andrew Morton Cc: linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Mel Gorman , Tejun Heo , Michal Hocko , Johannes Weiner , kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org, Christoph Lameter , David Rientjes , Pekka Enberg , devel-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On 10/18/2012 02:12 AM, Andrew Morton wrote: > On Tue, 16 Oct 2012 14:16:41 +0400 > Glauber Costa wrote: > >> This patch adds the basic infrastructure for the accounting of kernel >> memory. To control that, the following files are created: >> >> * memory.kmem.usage_in_bytes >> * memory.kmem.limit_in_bytes >> * memory.kmem.failcnt > > gargh. "failcnt" is not a word. Who was it who first thought that > omitting voewls from words improves anything? > > Sigh. That pooch is already screwed and there's nothing we can do > about it now. > Dunno =( >> * memory.kmem.max_usage_in_bytes >> >> They have the same meaning of their user memory counterparts. They >> reflect the state of the "kmem" res_counter. >> >> Per cgroup kmem memory accounting is not enabled until a limit is set >> for the group. Once the limit is set the accounting cannot be disabled >> for that group. This means that after the patch is applied, no >> behavioral changes exists for whoever is still using memcg to control >> their memory usage, until memory.kmem.limit_in_bytes is set for the >> first time. >> >> We always account to both user and kernel resource_counters. This >> effectively means that an independent kernel limit is in place when the >> limit is set to a lower value than the user memory. A equal or higher >> value means that the user limit will always hit first, meaning that kmem >> is effectively unlimited. >> >> People who want to track kernel memory but not limit it, can set this >> limit to a very high number (like RESOURCE_MAX - 1page - that no one >> will ever hit, or equal to the user memory) >> >> >> ... >> >> +/* internal only representation about the status of kmem accounting. */ >> +enum { >> + KMEM_ACCOUNTED_ACTIVE = 0, /* accounted by this cgroup itself */ >> +}; >> + >> +#define KMEM_ACCOUNTED_MASK (1 << KMEM_ACCOUNTED_ACTIVE) >> + >> +#ifdef CONFIG_MEMCG_KMEM >> +static void memcg_kmem_set_active(struct mem_cgroup *memcg) >> +{ >> + set_bit(KMEM_ACCOUNTED_ACTIVE, &memcg->kmem_accounted); >> +} >> +#endif > > I don't think memcg_kmem_set_active() really needs to exist. It has a > single caller and is unlikely to get any additional callers, so just > open-code it there? > Actually they exist as a way to make everything fit in closer to 80-columns without writing the function spanning 10 lines. I can open code them if you guys prefer. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx201.postini.com [74.125.245.201]) by kanga.kvack.org (Postfix) with SMTP id 5B7E16B0062 for ; Thu, 18 Oct 2012 05:03:37 -0400 (EDT) Message-ID: <5080365B.3000506@parallels.com> Date: Thu, 18 Oct 2012 21:03:23 +0400 From: Glauber Costa MIME-Version: 1.0 Subject: Re: [PATCH v5 04/14] kmem accounting basic infrastructure References: <1350382611-20579-1-git-send-email-glommer@parallels.com> <1350382611-20579-5-git-send-email-glommer@parallels.com> <20121017151207.e8bb3db2.akpm@linux-foundation.org> In-Reply-To: <20121017151207.e8bb3db2.akpm@linux-foundation.org> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton Cc: linux-mm@kvack.org, cgroups@vger.kernel.org, Mel Gorman , Tejun Heo , Michal Hocko , Johannes Weiner , kamezawa.hiroyu@jp.fujitsu.com, Christoph Lameter , David Rientjes , Pekka Enberg , devel@openvz.org, linux-kernel@vger.kernel.org On 10/18/2012 02:12 AM, Andrew Morton wrote: > On Tue, 16 Oct 2012 14:16:41 +0400 > Glauber Costa wrote: > >> This patch adds the basic infrastructure for the accounting of kernel >> memory. To control that, the following files are created: >> >> * memory.kmem.usage_in_bytes >> * memory.kmem.limit_in_bytes >> * memory.kmem.failcnt > > gargh. "failcnt" is not a word. Who was it who first thought that > omitting voewls from words improves anything? > > Sigh. That pooch is already screwed and there's nothing we can do > about it now. > Dunno =( >> * memory.kmem.max_usage_in_bytes >> >> They have the same meaning of their user memory counterparts. They >> reflect the state of the "kmem" res_counter. >> >> Per cgroup kmem memory accounting is not enabled until a limit is set >> for the group. Once the limit is set the accounting cannot be disabled >> for that group. This means that after the patch is applied, no >> behavioral changes exists for whoever is still using memcg to control >> their memory usage, until memory.kmem.limit_in_bytes is set for the >> first time. >> >> We always account to both user and kernel resource_counters. This >> effectively means that an independent kernel limit is in place when the >> limit is set to a lower value than the user memory. A equal or higher >> value means that the user limit will always hit first, meaning that kmem >> is effectively unlimited. >> >> People who want to track kernel memory but not limit it, can set this >> limit to a very high number (like RESOURCE_MAX - 1page - that no one >> will ever hit, or equal to the user memory) >> >> >> ... >> >> +/* internal only representation about the status of kmem accounting. */ >> +enum { >> + KMEM_ACCOUNTED_ACTIVE = 0, /* accounted by this cgroup itself */ >> +}; >> + >> +#define KMEM_ACCOUNTED_MASK (1 << KMEM_ACCOUNTED_ACTIVE) >> + >> +#ifdef CONFIG_MEMCG_KMEM >> +static void memcg_kmem_set_active(struct mem_cgroup *memcg) >> +{ >> + set_bit(KMEM_ACCOUNTED_ACTIVE, &memcg->kmem_accounted); >> +} >> +#endif > > I don't think memcg_kmem_set_active() really needs to exist. It has a > single caller and is unlikely to get any additional callers, so just > open-code it there? > Actually they exist as a way to make everything fit in closer to 80-columns without writing the function spanning 10 lines. I can open code them if you guys prefer. -- 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 S1754304Ab2JRJDe (ORCPT ); Thu, 18 Oct 2012 05:03:34 -0400 Received: from mx2.parallels.com ([64.131.90.16]:38604 "EHLO mx2.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753275Ab2JRJDd (ORCPT ); Thu, 18 Oct 2012 05:03:33 -0400 Message-ID: <5080365B.3000506@parallels.com> Date: Thu, 18 Oct 2012 21:03:23 +0400 From: Glauber Costa User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121009 Thunderbird/16.0 MIME-Version: 1.0 To: Andrew Morton CC: , , Mel Gorman , Tejun Heo , Michal Hocko , Johannes Weiner , , Christoph Lameter , David Rientjes , Pekka Enberg , , Subject: Re: [PATCH v5 04/14] kmem accounting basic infrastructure References: <1350382611-20579-1-git-send-email-glommer@parallels.com> <1350382611-20579-5-git-send-email-glommer@parallels.com> <20121017151207.e8bb3db2.akpm@linux-foundation.org> In-Reply-To: <20121017151207.e8bb3db2.akpm@linux-foundation.org> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/18/2012 02:12 AM, Andrew Morton wrote: > On Tue, 16 Oct 2012 14:16:41 +0400 > Glauber Costa wrote: > >> This patch adds the basic infrastructure for the accounting of kernel >> memory. To control that, the following files are created: >> >> * memory.kmem.usage_in_bytes >> * memory.kmem.limit_in_bytes >> * memory.kmem.failcnt > > gargh. "failcnt" is not a word. Who was it who first thought that > omitting voewls from words improves anything? > > Sigh. That pooch is already screwed and there's nothing we can do > about it now. > Dunno =( >> * memory.kmem.max_usage_in_bytes >> >> They have the same meaning of their user memory counterparts. They >> reflect the state of the "kmem" res_counter. >> >> Per cgroup kmem memory accounting is not enabled until a limit is set >> for the group. Once the limit is set the accounting cannot be disabled >> for that group. This means that after the patch is applied, no >> behavioral changes exists for whoever is still using memcg to control >> their memory usage, until memory.kmem.limit_in_bytes is set for the >> first time. >> >> We always account to both user and kernel resource_counters. This >> effectively means that an independent kernel limit is in place when the >> limit is set to a lower value than the user memory. A equal or higher >> value means that the user limit will always hit first, meaning that kmem >> is effectively unlimited. >> >> People who want to track kernel memory but not limit it, can set this >> limit to a very high number (like RESOURCE_MAX - 1page - that no one >> will ever hit, or equal to the user memory) >> >> >> ... >> >> +/* internal only representation about the status of kmem accounting. */ >> +enum { >> + KMEM_ACCOUNTED_ACTIVE = 0, /* accounted by this cgroup itself */ >> +}; >> + >> +#define KMEM_ACCOUNTED_MASK (1 << KMEM_ACCOUNTED_ACTIVE) >> + >> +#ifdef CONFIG_MEMCG_KMEM >> +static void memcg_kmem_set_active(struct mem_cgroup *memcg) >> +{ >> + set_bit(KMEM_ACCOUNTED_ACTIVE, &memcg->kmem_accounted); >> +} >> +#endif > > I don't think memcg_kmem_set_active() really needs to exist. It has a > single caller and is unlikely to get any additional callers, so just > open-code it there? > Actually they exist as a way to make everything fit in closer to 80-columns without writing the function spanning 10 lines. I can open code them if you guys prefer.