linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: nishimura@mxp.nes.nec.co.jp,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"balbir@linux.vnet.ibm.com" <balbir@linux.vnet.ibm.com>,
	"xemul@openvz.org" <xemul@openvz.org>,
	"menage@google.com" <menage@google.com>
Subject: Re: [RFC][PATCH 9/11] memcg : mem+swap controlelr kconfig
Date: Mon, 27 Oct 2008 15:39:11 +0900	[thread overview]
Message-ID: <20081027153911.c28285ad.nishimura@mxp.nes.nec.co.jp> (raw)
In-Reply-To: <20081023181220.80dc24c5.kamezawa.hiroyu@jp.fujitsu.com>

On Thu, 23 Oct 2008 18:12:20 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> 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 extenstion or not.
>   - CONFIG
>   - boot option
> 
> This version uses policy of "default is enable if configured."
> please tell me you dislike this. See patches following this in detail...
> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> 
>  Documentation/kernel-parameters.txt |    3 +++
>  include/linux/memcontrol.h          |    3 +++
>  init/Kconfig                        |   16 ++++++++++++++++
>  mm/memcontrol.c                     |   17 +++++++++++++++++
>  4 files changed, 39 insertions(+)
> 
> Index: mmotm-2.6.27+/init/Kconfig
> ===================================================================
> --- mmotm-2.6.27+.orig/init/Kconfig
> +++ mmotm-2.6.27+/init/Kconfig
> @@ -613,6 +613,22 @@ config KALLSYMS_EXTRA_PASS
>  	   reported.  KALLSYMS_EXTRA_PASS is only a temporary workaround while
>  	   you wait for kallsyms to be fixed.
>  
> +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 have no cares to
> +	  usage of swap...a process can exhaust the all swap. This extension
> +	  is useful when you want to avoid exhausion of 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 to enable this. When memory resource controller
> +	  is disabled by boot option, this will be automatiaclly 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.
> +
>  
hmm... "cgroup_disable=memory" doesn't fully disable this feature.

Even if specifying "cgroup_disable=memory", memory for table of swap_cgroup
is allocated at swapon because "do_swap_account" is not turned off.

I think it can be turned off adding some codes at mem_cgroup_create() like:

===
@@ -1881,6 +1881,8 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
        int node;

        if (unlikely((cont->parent) == NULL)) {
+               if (mem_cgroup_subsys.disabled)
+                       do_swap_account = 0;
                mem = &init_mem_cgroup;
                cpu_memcgroup_callback(&memcgroup_nb,
                                        (unsigned long)CPU_UP_PREPARE,
===

BTW, is there any reason to call cgroup_init_subsys() even when the subsys
is disabled by boot option?


Thanks,
Daisuke Nishimura.

>  config HOTPLUG
>  	bool "Support for hot-pluggable devices" if EMBEDDED
> Index: mmotm-2.6.27+/mm/memcontrol.c
> ===================================================================
> --- mmotm-2.6.27+.orig/mm/memcontrol.c
> +++ mmotm-2.6.27+/mm/memcontrol.c
> @@ -41,6 +41,13 @@
>  struct cgroup_subsys mem_cgroup_subsys __read_mostly;
>  #define MEM_CGROUP_RECLAIM_RETRIES	5
>  
> +#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
> +int do_swap_account __read_mostly = 1;
> +#else
> +#define do_swap_account		(0)
> +#endif
> +
> +
>  /*
>   * Statistics for memory cgroup.
>   */
> @@ -1658,3 +1665,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)
> +{
> +	do_swap_account = 0;
> +	return 1;
> +}
> +__setup("noswapaccount", disable_swap_account);
> +#endif
> Index: mmotm-2.6.27+/Documentation/kernel-parameters.txt
> ===================================================================
> --- mmotm-2.6.27+.orig/Documentation/kernel-parameters.txt
> +++ mmotm-2.6.27+/Documentation/kernel-parameters.txt
> @@ -1540,6 +1540,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.27+/include/linux/memcontrol.h
> ===================================================================
> --- mmotm-2.6.27+.orig/include/linux/memcontrol.h
> +++ mmotm-2.6.27+/include/linux/memcontrol.h
> @@ -80,6 +80,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;
> 

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2008-10-27  6:39 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-23  8:58 [RFC][PATCH 0/11] memcg updates / clean up, lazy lru ,mem+swap controller KAMEZAWA Hiroyuki
2008-10-23  8:59 ` [RFC][PATCH 1/11] memcg: fix kconfig menu comment KAMEZAWA Hiroyuki
2008-10-24  4:24   ` Randy Dunlap
2008-10-24  4:28     ` KAMEZAWA Hiroyuki
2008-10-23  9:00 ` [RFC][PATCH 2/11] cgroup: make cgroup kconfig as submenu KAMEZAWA Hiroyuki
2008-10-23 21:20   ` Paul Menage
2008-10-24  1:16     ` KAMEZAWA Hiroyuki
2008-10-23  9:02 ` [RFC][PATCH 3/11] memcg: charge commit cancel protocol KAMEZAWA Hiroyuki
2008-10-23  9:03 ` [RFC][PATCH 4/11] memcg: better page migration handling KAMEZAWA Hiroyuki
2008-10-23  9:05 ` [RFC][PATCH 5/11] memcg: account move and change force_empty KAMEZAWA Hiroyuki
2008-10-24  4:28   ` Randy Dunlap
2008-10-24  4:37     ` KAMEZAWA Hiroyuki
2008-10-23  9:06 ` [RFC][PATCH 6/11] memcg: lary LRU removal KAMEZAWA Hiroyuki
2008-10-23  9:08 ` [RFC][PATCH 7/11] memcg: lazy lru add KAMEZAWA Hiroyuki
2008-10-23  9:10 ` [RFC][PATCH 8/11] memcg: shmem account helper KAMEZAWA Hiroyuki
2008-10-23  9:12 ` [RFC][PATCH 9/11] memcg : mem+swap controlelr kconfig KAMEZAWA Hiroyuki
2008-10-24  4:32   ` Randy Dunlap
2008-10-24  4:37     ` KAMEZAWA Hiroyuki
2008-10-27  6:39   ` Daisuke Nishimura [this message]
2008-10-27  7:17     ` Li Zefan
2008-10-27  7:24       ` Daisuke Nishimura
2008-10-28  0:08     ` KAMEZAWA Hiroyuki
2008-10-23  9:13 ` [RFC][PATCH 10/11] memcg: swap cgroup KAMEZAWA Hiroyuki
2008-10-27  7:02   ` Daisuke Nishimura
2008-10-28  0:09     ` KAMEZAWA Hiroyuki
2008-10-23  9:16 ` [RFC][PATCH 11/11] memcg: mem+swap controler core KAMEZAWA Hiroyuki
2008-10-27 11:37   ` Daisuke Nishimura
2008-10-28  0:16     ` KAMEZAWA Hiroyuki
2008-10-28  2:06       ` Daisuke Nishimura
2008-10-28  2:30         ` 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=20081027153911.c28285ad.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-mm@kvack.org \
    --cc=menage@google.com \
    --cc=xemul@openvz.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox