linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Balbir Singh <balbir@linux.vnet.ibm.com>
To: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: containers@lists.osdl.org, linux-mm@kvack.org, xemul@openvz.org,
	Hugh Dickins <hugh@veritas.com>
Subject: Re: [RFC/PATCH] cgroup swap subsystem
Date: Wed, 05 Mar 2008 12:58:54 +0530	[thread overview]
Message-ID: <47CE4BB6.8050803@linux.vnet.ibm.com> (raw)
In-Reply-To: <47CE36A9.3060204@mxp.nes.nec.co.jp>

Daisuke Nishimura wrote:
> Hi.
> 
> Even if limiting memory usage by cgroup memory subsystem
> or isolating memory by cpuset, swap space is shared, so
> resource isolation is not enough. If one group uses up all the
> swap space, it can affect other groups.
> 

Yes, that is true. Please ensure that you also cc Hugh Dickins for all swap
related changes.

> I try making a patch of swap subsystem based on memory
> subsystem, which limits swap usage per cgroup.
> It can now charge and limit the swap usage.
> 
> I implemented this feature as a new subsystem,
> not as a part of memory subsystem, because I don't want to
> make big change to memcontrol.c, and even if implemented
> as other subsystem, users can manage memory and swap on
> the same cgroup directory if mount them together.
> 

I agree, the swap system should be independent of the memory resource controller.

> Basic idea of my implementation:
>   - what will be charged ?
>     the number of swap entries.
> 
>   - when to charge/uncharge ?
>     charge at get_swap_entry(), and uncharge at swap_entry_free().
> 

You mean get_swap_page(), I suppose. The assumption in the code is that every
swap page being charged has already been charged by the memory controller (that
will go against making the controllers independent). Also, be careful of any
charge operations under a spin_lock(). We tried controlling pages in the swap
cache, but Hugh found problems with it, specially due to accounting for pages
that are read ahead to the correct cgroup.

>   - to what group charge the swap entry ?
>     To determine to what swap_cgroup (corresponding to mem_cgroup in
>     memory subsystem) the swap entry should be charged,
>     I added a pointer to mm_struct to page_cgroup(pc->pc_mm), and
>     changed the argument of get_swap_entry() from (void) to
>     (struct page *). As a result, get_swap_entry() can determine
>     to what swap_cgroup it should charge the swap entry
>     by referring to page->page_cgroup->mm_struct->swap_cgroup.
> 

I presume this is for the case when the memory and swap controllers are mounted
in different hierarchies. It seems like too many dereferences to get to the
swap_cgroup

>   - from what group uncharge the swap entry ?
>     I added to swap_info_struct a member 'struct swap_cgroup **',
>     array of pointer to which swap_cgroup the swap entry is
>     charged.
> 
> Todo:
>   - rebase new kernel, and split into some patches.
>   - Merge with memory subsystem (if it would be better), or
>     remove dependency on CONFIG_CGROUP_MEM_CONT if possible
>     (needs to make page_cgroup more generic one).
>   - More tests, cleanups, and feartures   :-)  
> 
> 
> Any comments or discussions would be appreciated.
> 

To be honest, I tried looking at the code, but there were too many #ifdefs and I
sort of lost myself in them.

> Thanks,
> Daisuke Nishimura
> 

-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL

--
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-03-05  7:30 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05  5:59 [RFC/PATCH] cgroup swap subsystem Daisuke Nishimura
2008-03-05  6:36 ` Paul Menage
2008-03-06 12:20   ` Daisuke Nishimura
2008-03-05  6:53 ` KAMEZAWA Hiroyuki
2008-03-05 21:51   ` Hirokazu Takahashi
2008-03-06 11:45   ` Daisuke Nishimura
2008-03-06 12:25     ` Pavel Emelyanov
2008-03-06 12:56   ` kamezawa.hiroyu
2008-03-07  8:22     ` Daisuke Nishimura
2008-03-12 22:57     ` YAMAMOTO Takashi
2008-03-05  7:03 ` KAMEZAWA Hiroyuki
2008-03-05  7:28 ` Balbir Singh [this message]
2008-03-07  4:23   ` Daisuke Nishimura
2008-03-05  8:33 ` Pavel Emelyanov
2008-03-05  8:51   ` Daisuke Nishimura
2008-03-05 14:07   ` Hugh Dickins
2008-03-05 14:14     ` Pavel Emelyanov
2008-03-06  0:33       ` KAMEZAWA Hiroyuki
2008-03-06  0:35         ` Paul Menage
2008-03-06  8:20         ` Pavel Emelyanov
2008-03-06  8:33           ` KAMEZAWA Hiroyuki
2008-03-06  8:38             ` Pavel Emelyanov
2008-03-06  8:48               ` [Devel] " Paul Menage
2008-03-06  8:50                 ` Pavel Emelyanov
2008-03-06  8:52                   ` Paul Menage

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=47CE4BB6.8050803@linux.vnet.ibm.com \
    --to=balbir@linux.vnet.ibm.com \
    --cc=containers@lists.osdl.org \
    --cc=hugh@veritas.com \
    --cc=linux-mm@kvack.org \
    --cc=nishimura@mxp.nes.nec.co.jp \
    --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;
as well as URLs for NNTP newsgroup(s).