LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
	"menage@google.com" <menage@google.com>,
	nishimura@mxp.nes.nec.co.jp
Subject: Re: [RFC][PATCH 3/6] memcg : mem+swap controller kconfig
Date: Thu, 6 Nov 2008 20:07:25 +0900	[thread overview]
Message-ID: <20081106200725.961e8f8f.nishimura@mxp.nes.nec.co.jp> (raw)
In-Reply-To: <20081105172050.1b280c56.kamezawa.hiroyu@jp.fujitsu.com>

On Wed, 5 Nov 2008 17:20:50 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> Experimental.
> 
> Config and control variable for mem+swap controller.
> 
> This patch adds CONFIG_CGROUP_MEM_RES_CTLR_SWAP
> (memory resource controller swap extension.)
> 
> For accounting swap, it's obvious that we have to use additional memory
> to remember "who uses swap". This adds more overhead.
> So, it's better to offer "choice" to users. This patch adds 2 choices.
> 
> This patch adds 2 parameters to enable swap extension or not.
>   - CONFIG
>   - boot option
> 
> Changelog: v1 -> v2
>  - fixed typo.
>  - make default value of "do_swap_account" to be 0 and turned on 1
>    later if configured.
> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
looks good to me.

	Reviewed-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>

> 
>  Documentation/kernel-parameters.txt |    3 +++
>  include/linux/memcontrol.h          |    3 +++
>  init/Kconfig                        |   17 +++++++++++++++++
>  mm/memcontrol.c                     |   32 ++++++++++++++++++++++++++++++++
>  4 files changed, 55 insertions(+)
> 
> Index: mmotm-2.6.28-rc2+/init/Kconfig
> ===================================================================
> --- mmotm-2.6.28-rc2+.orig/init/Kconfig
> +++ mmotm-2.6.28-rc2+/init/Kconfig
> @@ -428,6 +428,23 @@ config CGROUP_MEM_RES_CTLR
>  config MM_OWNER
>  	bool
>  
> +config CGROUP_MEM_RES_CTLR_SWAP
> +	bool "Memory Resource Controller Swap Extension(EXPERIMENTAL)"
> +	depends on CGROUP_MEM_RES_CTLR && SWAP && EXPERIMENTAL
> +	help
> +	  Add swap management feature to memory resource controller. When you
> +	  enable this, you can limit mem+swap usage per cgroup. In other words,
> +	  when you disable this, memory resource controller has no cares to
> +	  usage of swap...a process can exhaust all of the swap. This extension
> +	  is useful when you want to avoid exhaustion swap but this itself
> +	  adds more overheads and consumes memory for remembering information.
> +	  Especially if you use 32bit system or small memory system, please
> +	  be careful about enabling this. When memory resource controller
> +	  is disabled by boot option, this will be automatically disabled and
> +	  there will be no overhead from this. Even when you set this config=y,
> +	  if boot option "noswapaccount" is set, swap will not be accounted.
> +
> +
>  endmenu
>  
>  config SYSFS_DEPRECATED
> Index: mmotm-2.6.28-rc2+/mm/memcontrol.c
> ===================================================================
> --- mmotm-2.6.28-rc2+.orig/mm/memcontrol.c
> +++ mmotm-2.6.28-rc2+/mm/memcontrol.c
> @@ -41,6 +41,15 @@
>  struct cgroup_subsys mem_cgroup_subsys __read_mostly;
>  #define MEM_CGROUP_RECLAIM_RETRIES	5
>  
> +#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
> +/* Turned on only when memory cgroup is enabled && really_do_swap_account = 0 */
> +int do_swap_account __read_mostly;
> +static int really_do_swap_account __initdata = 1; /* for remember boot option*/
> +#else
> +#define do_swap_account		(0)
> +#endif
> +
> +
>  /*
>   * Statistics for memory cgroup.
>   */
> @@ -1370,6 +1379,18 @@ static void mem_cgroup_free(struct mem_c
>  }
>  
>  
> +#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
> +static void __init enable_swap_cgroup(void)
> +{
> +	if (!mem_cgroup_subsys.disabled && really_do_swap_account)
> +		do_swap_account = 1;
> +}
> +#else
> +static void __init enable_swap_cgroup(void)
> +{
> +}
> +#endif
> +
>  static struct cgroup_subsys_state *
>  mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
>  {
> @@ -1378,6 +1399,7 @@ mem_cgroup_create(struct cgroup_subsys *
>  
>  	if (unlikely((cont->parent) == NULL)) {
>  		mem = &init_mem_cgroup;
> +		enable_swap_cgroup();
>  	} else {
>  		mem = mem_cgroup_alloc();
>  		if (!mem)
> @@ -1461,3 +1483,13 @@ struct cgroup_subsys mem_cgroup_subsys =
>  	.attach = mem_cgroup_move_task,
>  	.early_init = 0,
>  };
> +
> +#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
> +
> +static int __init disable_swap_account(char *s)
> +{
> +	really_do_swap_account = 0;
> +	return 1;
> +}
> +__setup("noswapaccount", disable_swap_account);
> +#endif
> Index: mmotm-2.6.28-rc2+/Documentation/kernel-parameters.txt
> ===================================================================
> --- mmotm-2.6.28-rc2+.orig/Documentation/kernel-parameters.txt
> +++ mmotm-2.6.28-rc2+/Documentation/kernel-parameters.txt
> @@ -1543,6 +1543,9 @@ and is between 256 and 4096 characters. 
>  
>  	nosoftlockup	[KNL] Disable the soft-lockup detector.
>  
> +	noswapaccount	[KNL] Disable accounting of swap in memory resource
> +			controller. (See Documentation/controllers/memory.txt)
> +
>  	nosync		[HW,M68K] Disables sync negotiation for all devices.
>  
>  	notsc		[BUGS=X86-32] Disable Time Stamp Counter
> Index: mmotm-2.6.28-rc2+/include/linux/memcontrol.h
> ===================================================================
> --- mmotm-2.6.28-rc2+.orig/include/linux/memcontrol.h
> +++ mmotm-2.6.28-rc2+/include/linux/memcontrol.h
> @@ -77,6 +77,9 @@ extern void mem_cgroup_record_reclaim_pr
>  extern long mem_cgroup_calc_reclaim(struct mem_cgroup *mem, struct zone *zone,
>  					int priority, enum lru_list lru);
>  
> +#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
> +extern int do_swap_account;
> +#endif
>  
>  #else /* CONFIG_CGROUP_MEM_RES_CTLR */
>  struct mem_cgroup;
> 

  reply	other threads:[~2008-11-06 11:49 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-05  8:16 [RFC][PATCH 0/6] memcg updates (05/Nov) KAMEZAWA Hiroyuki
2008-11-05  8:18 ` [RFC][PATCH 1/6] memcg: move all accounts to parent at rmdir() KAMEZAWA Hiroyuki
2008-11-05  8:20 ` [RFC][PATCH 2/6] memcg: handle swap cache KAMEZAWA Hiroyuki
2008-11-07  8:53   ` Daisuke Nishimura
2008-11-07  9:13     ` KAMEZAWA Hiroyuki
2008-11-05  8:20 ` [RFC][PATCH 3/6] memcg : mem+swap controller kconfig KAMEZAWA Hiroyuki
2008-11-06 11:07   ` Daisuke Nishimura [this message]
2008-11-05  8:21 ` [RFC][PATCH 4/6] memcg : swap cgroup KAMEZAWA Hiroyuki
2008-11-06 11:25   ` Daisuke Nishimura
2008-11-06 12:44     ` KAMEZAWA Hiroyuki
2008-11-07  1:19       ` Daisuke Nishimura
2008-11-05  8:23 ` [RFC][PATCH 5/6] memcg: mem+swap controller KAMEZAWA Hiroyuki
2008-11-07  9:02   ` Daisuke Nishimura
2008-11-07  9:19     ` KAMEZAWA Hiroyuki
2008-11-07 13:30       ` Daisuke Nishimura
2008-11-07 13:21   ` Daisuke Nishimura
2008-11-10  4:30   ` Daisuke Nishimura
2008-11-10  7:03     ` KAMEZAWA Hiroyuki
2008-11-05  8:24 ` [RFC][PATCH 6/6] memcg: synchronized LRU KAMEZAWA Hiroyuki
2008-11-06  6:54 ` [RFC][PATCH 0/6] memcg updates (05/Nov) Balbir Singh
2008-11-06  7:03   ` KAMEZAWA Hiroyuki
2008-11-06 10:41   ` [RFC][PATCH 7/6] memcg: add atribute (for change bahavior of rmdir) KAMEZAWA Hiroyuki
2008-11-06 11:59     ` Hugh Dickins
2008-11-06 12:47       ` [RFC][PATCH 7/6] memcg: add atribute (for change bahavior ofrmdir) KAMEZAWA Hiroyuki
2008-11-06 13:46     ` [RFC][PATCH 7/6] memcg: add atribute (for change bahavior of rmdir) Balbir Singh
2008-11-06 14:30       ` [RFC][PATCH 7/6] memcg: add atribute (for change bahavior ofrmdir) KAMEZAWA Hiroyuki
2008-11-07  1:12         ` KAMEZAWA Hiroyuki
2008-11-12  3:26 [RFC][PATCH 0/6] memcg updates (12/Nov/2008) KAMEZAWA Hiroyuki
2008-11-12  3:28 ` [RFC][PATCH 3/6] memcg: mem+swap controller kconfig KAMEZAWA Hiroyuki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081106200725.961e8f8f.nishimura@mxp.nes.nec.co.jp \
    --to=nishimura@mxp.nes.nec.co.jp \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=menage@google.com \
    --subject='Re: [RFC][PATCH 3/6] memcg : mem+swap controller kconfig' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).