OpenVZ Forum - RDF feed
type: channel
items: [-mm PATCH 0/10] Memory controller introduction (v7)
items: [-mm PATCH 1/10] Memory controller resource counters (v7)
items: [-mm PATCH 2/10] Memory controller containers setup (v7)
items: [-mm PATCH 3/10] Memory controller accounting setup (v7)
items: [-mm PATCH 4/10] Memory controller memory accounting (v7)
items: [-mm PATCH 5/10] Memory controller task migration (v7)
items: [-mm PATCH 6/10] Memory controller add per container LRU and reclaim (v7)
items: [-mm PATCH 7/10] Memory controller OOM handling (v7)
items: [-mm PATCH 8/10] Memory controller add switch to control what type of pages to limit (v7)
items: [-mm PATCH 9/10] Memory controller make page_referenced() container aware (v7)
items: [-mm PATCH 10/10] Memory controller add documentation
items: Re: [-mm PATCH 5/10] Memory controller task migration (v7)

[-mm PATCH 0/10] Memory controller introduction (v7)
type: item
description: Hi, Andrew, Here's version 7 of the memory controller (against 2.6.23-rc2-mm2). I was told "7" is a lucky number, so I am hopeful this version of the patchset will get merged ;) The salient features of the patches are a. Provides *zero overhead* for non memory controller users b. Enable control of both RSS (mapped) and Page Cache (unmapped) pages c. The infrastructure allows easy addition of other types of memory to control d. Provides a double LRU: global memory pressure causes reclaim from the global LRU; a container on hitting a limit, reclaims from the per container LRU The documentation accompanying this patch has more details on the design and usage. Changelog since version 6 1. Port to 2.6.23-rc3-mm1 2. Add new documentation Tested the patches (with config disabled) and kernbench, lmbench on an x86_64 box. For more detailed test results, comments on usage and detailed changelog please see version 6 of the patches http://lwn.net/Articles/246140/ series mem-control-res-counters-infrastructure mem-control-setup mem-control-accounting-setup mem-control-accounting mem-control-task-migration mem-control-lru-and-reclaim mem-control-out-of-memory mem-control-choose-rss-vs-rss-and-pagecache mem-control-per-container-page-referenced mem-control-documentation -- Warm Regards, Balbir Singh Linux Technology Center IBM, ISTL _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: Balbir Singh
date: 2007-08-24T15:19:48-00:00

[-mm PATCH 1/10] Memory controller resource counters (v7)
type: item
description: From: Pavel Emelianov <xemul@openvz.org> Introduce generic structures and routines for resource accounting. Each resource accounting container is supposed to aggregate it, container_subsystem_state and its resource-specific members within. Signed-off-by: Pavel Emelianov <xemul@openvz.org> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> --- include/linux/res_counter.h | 102 +++++++++++++++++++++++++++++++++++++ init/Kconfig | 7 ++ kernel/Makefile | 1 kernel/res_counter.c | 120 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 230 insertions(+) diff -puN /dev/null include/linux/res_counter.h --- /dev/null 2007-06-01 20:42:04.000000000 +0530 +++ linux-2.6.23-rc2-mm2-balbir/include/linux/res_counter.h 2007-08-24 20:46:06.000000000 +0530 @@ -0,0 +1,102 @@ +#ifndef __RES_COUNTER_H__ +#define __RES_COUNTER_H__ + +/* + * Resource Counters + * Contain common data types and routines for resource accounting + * + * Copyright 2007 OpenVZ SWsoft Inc + * + * Author: Pavel Emelianov <xemul@openvz.org> + * + */ + +#include <linux/container.h> + +/* + * The core object. the container that wishes to account for some + * resource may include this counter into its structures and use + * the helpers described beyond + */ + +struct res_counter { + /* + * the current resource consumption level + */ + unsigned long usage; + /* + * the limit that usage cannot exceed + */ + unsigned long limit; + /* + * the number of unsuccessful attempts to consume the resource + */ + unsigned long failcnt; + /* + * the lock to protect all of the above. + * the routines below consider this to be IRQ-safe + */ + spinlock_t lock; +}; + +/* + * Helpers to interact with userspace + * res_counter_read/_write - put/get the specified fields from the + * res_counter struct to/from the user + * + * @counter: the counter in question + * @member: the field to work with (see RES_xxx below) + * @buf: the buffer to opeate on,... + * @nbytes: its size... + * @pos: and the offset. + */ + +ssize_t res_co…
creator: Balbir Singh
date: 2007-08-24T15:19:58-00:00

[-mm PATCH 2/10] Memory controller containers setup (v7)
type: item
description: Changelong 1. use depends instead of select in init/Kconfig 2. Port to v11 3. Clean up the usage of names (container files) for v11 Setup the memory container and add basic hooks and controls to integrate and work with the container. Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> --- include/linux/container_subsys.h | 6 + include/linux/memcontrol.h | 21 ++++++ init/Kconfig | 7 ++ mm/Makefile | 1 mm/memcontrol.c | 127 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 162 insertions(+) diff -puN include/linux/container_subsys.h~mem-control-setup include/linux/container_subsys.h --- linux-2.6.23-rc2-mm2/include/linux/container_subsys.h~mem-control-setup 2007-08-24 20:46:06.000000000 +0530 +++ linux-2.6.23-rc2-mm2-balbir/include/linux/container_subsys.h 2007-08-24 20:46:06.000000000 +0530 @@ -30,3 +30,9 @@ SUBSYS(ns) #endif /* */ + +#ifdef CONFIG_CONTAINER_MEM_CONT +SUBSYS(mem_container) +#endif + +/* */ diff -puN /dev/null include/linux/memcontrol.h --- /dev/null 2007-06-01 20:42:04.000000000 +0530 +++ linux-2.6.23-rc2-mm2-balbir/include/linux/memcontrol.h 2007-08-24 20:46:06.000000000 +0530 @@ -0,0 +1,21 @@ +/* memcontrol.h - Memory Controller + * + * Copyright IBM Corporation, 2007 + * Author Balbir Singh <balbir@linux.vnet.ibm.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _LINUX_MEMCONTROL_H +#define _LINUX_MEMCONTROL_H + +#endif /* _LINUX_MEMCONTROL_H */ + diff -puN init/Kconfig~mem-control-setup init/Kconfig --- linux-2.6.23-rc2-mm2/init/Kconfig~mem-control-setup 2007-0…
creator: Balbir Singh
date: 2007-08-24T15:20:09-00:00

[-mm PATCH 3/10] Memory controller accounting setup (v7)
type: item
description: From: Pavel Emelianov <xemul@openvz.org> Changelog for v5 1. Remove inclusion of memcontrol.h from mm_types.h Changelog As per Paul's review comments 1. Drop css_get() for the root memory container 2. Use mem_container_from_task() as an optimization instead of using mem_container_from_cont() along with task_container. Basic setup routines, the mm_struct has a pointer to the container that it belongs to and the the page has a page_container associated with it. Signed-off-by: Pavel Emelianov <xemul@openvz.org> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> --- include/linux/memcontrol.h | 36 ++++++++++++++++++++++++++++ include/linux/mm_types.h | 6 ++++ include/linux/sched.h | 1 kernel/fork.c | 11 ++++++-- mm/memcontrol.c | 57 +++++++++++++++++++++++++++++++++++++++++---- 5 files changed, 104 insertions(+), 7 deletions(-) diff -puN include/linux/memcontrol.h~mem-control-accounting-setup include/linux/memcontrol.h --- linux-2.6.23-rc2-mm2/include/linux/memcontrol.h~mem-control-accounting-setup 2007-08-24 20:46:07.000000000 +0530 +++ linux-2.6.23-rc2-mm2-balbir/include/linux/memcontrol.h 2007-08-24 20:46:07.000000000 +0530 @@ -3,6 +3,9 @@ * Copyright IBM Corporation, 2007 * Author Balbir Singh <balbir@linux.vnet.ibm.com> * + * Copyright 2007 OpenVZ SWsoft Inc + * Author: Pavel Emelianov <xemul@openvz.org> + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -17,5 +20,38 @@ #ifndef _LINUX_MEMCONTROL_H #define _LINUX_MEMCONTROL_H +struct mem_container; +struct page_container; + +#ifdef CONFIG_CONTAINER_MEM_CONT + +extern void mm_init_container(struct mm_struct *mm, struct task_struct *p); +extern void mm_free_container(struct mm_struct *mm); +extern void page_assign_page_container(struct page *page, + struct page_container *pc); +extern struct page_container *page_get_page_container(struct page *page);…
creator: Balbir Singh
date: 2007-08-24T15:20:19-00:00

[-mm PATCH 4/10] Memory controller memory accounting (v7)
type: item
description: Changelog for v6 1. Do a css_put() in the case of a race in allocating page containers (YAMAMOTO Takashi) Changelog for v5 1. Rename meta_page to page_container 2. Remove PG_metapage and use the lower bit of the page_container pointer for locking Changelog for v3 1. Fix a probable leak with meta_page's (pointed out by Paul Menage) 2. Introduce a wrapper around mem_container_uncharge for uncharging pages mem_container_uncharge_page() Changelog 1. Improved error handling, uncharge on errors and check to see if we are leaking pages (review by YAMAMOTO Takashi) Add the accounting hooks. The accounting is carried out for RSS and Page Cache (unmapped) pages. There is now a common limit and accounting for both. The RSS accounting is accounted at page_add_*_rmap() and page_remove_rmap() time. Page cache is accounted at add_to_page_cache(), __delete_from_page_cache(). Swap cache is also accounted for. Each page's page_container is protected with the last bit of the page_container pointer, this makes handling of race conditions involving simultaneous mappings of a page easier. A reference count is kept in the page_container to deal with cases where a page might be unmapped from the RSS of all tasks, but still lives in the page cache. Credits go to Vaidyanathan Srinivasan for helping with reference counting work of the page container. Almost all of the page cache accounting code has help from Vaidyanathan Srinivasan. Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> --- include/linux/memcontrol.h | 20 +++++ mm/filemap.c | 12 ++- mm/memcontrol.c | 166 ++++++++++++++++++++++++++++++++++++++++++++- mm/memory.c | 43 ++++++++++- mm/migrate.c | 6 + mm/page_alloc.c | 3 mm/rmap.c | 17 ++++ mm/swap_state.c | 12 ++- mm/swapfile.c | 41 ++++++----- 9 files changed, 293 insertions(+), 27 deletions(-) diff -puN include/linux/memcontrol.h~mem-control-accounting include/linux/memcontrol.h --- linux-2.6.23-rc2-mm2/include…
creator: Balbir Singh
date: 2007-08-24T15:20:30-00:00

[-mm PATCH 5/10] Memory controller task migration (v7)
type: item
description: Allow tasks to migrate from one container to the other. We migrate mm_struct's mem_container only when the thread group id migrates. Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> --- mm/memcontrol.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff -puN mm/memcontrol.c~mem-control-task-migration mm/memcontrol.c --- linux-2.6.23-rc2-mm2/mm/memcontrol.c~mem-control-task-migration 2007-08-24 20:46:07.000000000 +0530 +++ linux-2.6.23-rc2-mm2-balbir/mm/memcontrol.c 2007-08-24 20:46:07.000000000 +0530 @@ -326,11 +326,46 @@ static int mem_container_populate(struct ARRAY_SIZE(mem_container_files)); } +static void mem_container_move_task(struct container_subsys *ss, + struct container *cont, + struct container *old_cont, + struct task_struct *p) +{ + struct mm_struct *mm; + struct mem_container *mem, *old_mem; + + mm = get_task_mm(p); + if (mm == NULL) + return; + + mem = mem_container_from_cont(cont); + old_mem = mem_container_from_cont(old_cont); + + if (mem == old_mem) + goto out; + + /* + * Only thread group leaders are allowed to migrate, the mm_struct is + * in effect owned by the leader + */ + if (p->tgid != p->pid) + goto out; + + css_get(&mem->css); + rcu_assign_pointer(mm->mem_container, mem); + css_put(&old_mem->css); + +out: + mmput(mm); + return; +} + struct container_subsys mem_container_subsys = { .name = "memory", .subsys_id = mem_container_subsys_id, .create = mem_container_create, .destroy = mem_container_destroy, .populate = mem_container_populate, + .attach = mem_container_move_task, .early_init = 1, }; _ -- Warm Regards, Balbir Singh Linux Technology Center IBM, ISTL _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: Balbir Singh
date: 2007-08-24T15:20:43-00:00

[-mm PATCH 6/10] Memory controller add per container LRU and reclaim (v7)
type: item
description: Changelog since v3 1. Added reclaim retry logic to avoid being OOM'ed due to pages from swap cache (coming in due to reclaim) don't overwhelm the container. Changelog 1. Fix probable NULL pointer dereference based on review comments by YAMAMOTO Takashi Add the page_container to the per container LRU. The reclaim algorithm has been modified to make the isolate_lru_pages() as a pluggable component. The scan_control data structure now accepts the container on behalf of which reclaims are carried out. try_to_free_pages() has been extended to become container aware. Signed-off-by: Pavel Emelianov <xemul@openvz.org> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> --- include/linux/memcontrol.h | 12 +++ include/linux/res_counter.h | 23 +++++++ include/linux/swap.h | 3 mm/memcontrol.c | 135 +++++++++++++++++++++++++++++++++++++++++++- mm/swap.c | 2 mm/vmscan.c | 126 ++++++++++++++++++++++++++++++++--------- 6 files changed, 275 insertions(+), 26 deletions(-) diff -puN include/linux/memcontrol.h~mem-control-lru-and-reclaim include/linux/memcontrol.h --- linux-2.6.23-rc2-mm2/include/linux/memcontrol.h~mem-control-lru-and-reclaim 2007-08-24 20:46:07.000000000 +0530 +++ linux-2.6.23-rc2-mm2-balbir/include/linux/memcontrol.h 2007-08-24 20:46:07.000000000 +0530 @@ -32,6 +32,13 @@ extern void page_assign_page_container(s extern struct page_container *page_get_page_container(struct page *page); extern int mem_container_charge(struct page *page, struct mm_struct *mm); extern void mem_container_uncharge(struct page_container *pc); +extern void mem_container_move_lists(struct page_container *pc, bool active); +extern unsigned long mem_container_isolate_pages(unsigned long nr_to_scan, + struct list_head *dst, + unsigned long *scanned, int order, + int mode, struct zone *z, + struct mem_container *mem_cont, + int active); static inline void mem_container_uncharge_page(struct page *page) { @@ -71,6 +78,11 @@ static inline void mem_container_uncharg { } +static inline void mem_con…
creator: Balbir Singh
date: 2007-08-24T15:20:53-00:00

[-mm PATCH 7/10] Memory controller OOM handling (v7)
type: item
description: From: Pavel Emelianov <xemul@openvz.org> Out of memory handling for containers over their limit. A task from the container over limit is chosen using the existing OOM logic and killed. TODO: 1. As discussed in the OLS BOF session, consider implementing a user space policy for OOM handling. Signed-off-by: Pavel Emelianov <xemul@openvz.org> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> --- include/linux/memcontrol.h | 1 + mm/memcontrol.c | 1 + mm/oom_kill.c | 42 ++++++++++++++++++++++++++++++++++++++---- 3 files changed, 40 insertions(+), 4 deletions(-) diff -puN include/linux/memcontrol.h~mem-control-out-of-memory include/linux/memcontrol.h --- linux-2.6.23-rc2-mm2/include/linux/memcontrol.h~mem-control-out-of-memory 2007-08-24 20:46:08.000000000 +0530 +++ linux-2.6.23-rc2-mm2-balbir/include/linux/memcontrol.h 2007-08-24 20:46:08.000000000 +0530 @@ -39,6 +39,7 @@ extern unsigned long mem_container_isola int mode, struct zone *z, struct mem_container *mem_cont, int active); +extern void mem_container_out_of_memory(struct mem_container *mem); static inline void mem_container_uncharge_page(struct page *page) { diff -puN mm/memcontrol.c~mem-control-out-of-memory mm/memcontrol.c --- linux-2.6.23-rc2-mm2/mm/memcontrol.c~mem-control-out-of-memory 2007-08-24 20:46:08.000000000 +0530 +++ linux-2.6.23-rc2-mm2-balbir/mm/memcontrol.c 2007-08-24 20:46:08.000000000 +0530 @@ -322,6 +322,7 @@ int mem_container_charge(struct page *pa } css_put(&mem->css); + mem_container_out_of_memory(mem); goto free_pc; } diff -puN mm/oom_kill.c~mem-control-out-of-memory mm/oom_kill.c --- linux-2.6.23-rc2-mm2/mm/oom_kill.c~mem-control-out-of-memory 2007-08-24 20:46:08.000000000 +0530 +++ linux-2.6.23-rc2-mm2-balbir/mm/oom_kill.c 2007-08-24 20:46:08.000000000 +0530 @@ -25,6 +25,7 @@ #include <linux/cpuset.h> #include <linux/module.h> #include <linux/notifier.h> +#include <linux/memcontrol.h> int sysctl_panic_on_oom; /* #define DEBUG */ @@ -48,7 +49,8 @@ int sysctl_panic_on_oom; * of least s…
creator: Balbir Singh
date: 2007-08-24T15:21:05-00:00

[-mm PATCH 8/10] Memory controller add switch to control what type of pages to limit (v7)
type: item
description: Choose if we want cached pages to be accounted or not. By default both are accounted for. A new set of tunables are added. echo -n 1 > mem_control_type switches the accounting to account for only mapped pages echo -n 3 > mem_control_type switches the behaviour back Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> --- include/linux/memcontrol.h | 9 ++++ mm/filemap.c | 2 mm/memcontrol.c | 92 +++++++++++++++++++++++++++++++++++++++++++++ mm/swap_state.c | 2 4 files changed, 103 insertions(+), 2 deletions(-) diff -puN include/linux/memcontrol.h~mem-control-choose-rss-vs-rss-and-pagecache include/linux/memcontrol.h --- linux-2.6.23-rc2-mm2/include/linux/memcontrol.h~mem-control-choose-rss-vs-rss-and-pagecache 2007-08-24 20:46:08.000000000 +0530 +++ linux-2.6.23-rc2-mm2-balbir/include/linux/memcontrol.h 2007-08-24 20:46:08.000000000 +0530 @@ -20,6 +20,8 @@ #ifndef _LINUX_MEMCONTROL_H #define _LINUX_MEMCONTROL_H +#include <linux/mm.h> + struct mem_container; struct page_container; @@ -40,6 +42,7 @@ extern unsigned long mem_container_isola struct mem_container *mem_cont, int active); extern void mem_container_out_of_memory(struct mem_container *mem); +extern int mem_container_cache_charge(struct page *page, struct mm_struct *mm); static inline void mem_container_uncharge_page(struct page *page) { @@ -84,6 +87,12 @@ static inline void mem_container_move_li { } +static inline int mem_container_cache_charge(struct page *page, + struct mm_struct *mm) +{ + return 0; +} + #endif /* CONFIG_CONTAINER_MEM_CONT */ #endif /* _LINUX_MEMCONTROL_H */ diff -puN mm/filemap.c~mem-control-choose-rss-vs-rss-and-pagecache mm/filemap.c --- linux-2.6.23-rc2-mm2/mm/filemap.c~mem-control-choose-rss-vs-rss-and-pagecache 2007-08-24 20:46:08.000000000 +0530 +++ linux-2.6.23-rc2-mm2-balbir/mm/filemap.c 2007-08-24 20:46:08.000000000 +0530 @@ -445,7 +445,7 @@ int add_to_page_cache(struct page *page, if (error == 0) { - error = mem_container_charge(page, current->mm); + error = mem_container_cache…
creator: Balbir Singh
date: 2007-08-24T15:21:15-00:00

[-mm PATCH 9/10] Memory controller make page_referenced() container aware (v7)
type: item
description: Make page_referenced() container aware. Without this patch, page_referenced() can cause a page to be skipped while reclaiming pages. This patch ensures that other containers do not hold pages in a particular container hostage. It is required to ensure that shared pages are freed from a container when they are not actively referenced from the container that brought them in Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> --- include/linux/memcontrol.h | 6 ++++++ include/linux/rmap.h | 5 +++-- mm/memcontrol.c | 5 +++++ mm/rmap.c | 30 ++++++++++++++++++++++++------ mm/vmscan.c | 4 ++-- 5 files changed, 40 insertions(+), 10 deletions(-) diff -puN include/linux/rmap.h~mem-control-per-container-page-referenced include/linux/rmap.h --- linux-2.6.23-rc2-mm2/include/linux/rmap.h~mem-control-per-container-page-referenced 2007-08-24 20:46:08.000000000 +0530 +++ linux-2.6.23-rc2-mm2-balbir/include/linux/rmap.h 2007-08-24 20:46:08.000000000 +0530 @@ -8,6 +8,7 @@ #include <linux/slab.h> #include <linux/mm.h> #include <linux/spinlock.h> +#include <linux/memcontrol.h> /* * The anon_vma heads a list of private "related" vmas, to scan if @@ -86,7 +87,7 @@ static inline void page_dup_rmap(struct /* * Called from mm/vmscan.c to handle paging out */ -int page_referenced(struct page *, int is_locked); +int page_referenced(struct page *, int is_locked, struct mem_container *cnt); int try_to_unmap(struct page *, int ignore_refs); /* @@ -114,7 +115,7 @@ int page_mkclean(struct page *); #define anon_vma_prepare(vma) (0) #define anon_vma_link(vma) do {} while (0) -#define page_referenced(page,l) TestClearPageReferenced(page) +#define page_referenced(page,l,cnt) TestClearPageReferenced(page) #define try_to_unmap(page, refs) SWAP_FAIL static inline int page_mkclean(struct page *page) diff -puN mm/rmap.c~mem-control-per-container-page-referenced mm/rmap.c --- linux-2.6.23-rc2-mm2/mm/rmap.c~mem-control-per-container-page-referenced 2007-08-24 20:46:08.000000000 +0530 +++ linux-2.6.23-rc2-m…
creator: Balbir Singh
date: 2007-08-24T15:21:26-00:00

[-mm PATCH 10/10] Memory controller add documentation
type: item
description: Changelog since version 1 1. Wording and punctuation comments - Randy Dunlap 2. Differentiate between RSS and Page Cache - Paul Menage 3. Add detailed description of features - KAMEZAWA Hiroyuki 4. Fix a typo (drop_pages should be drop_caches) - YAMAMOTO Takshi Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> --- Documentation/controllers/memory.txt | 259 +++++++++++++++++++++++++++++++++++ 1 file changed, 259 insertions(+) diff -L Documentation/memcontrol.txt -puN /dev/null /dev/null diff -puN /dev/null Documentation/controllers/memory.txt --- /dev/null 2007-06-01 20:42:04.000000000 +0530 +++ linux-2.6.23-rc2-mm2-balbir/Documentation/controllers/memory.txt 2007-08-24 20:46:08.000000000 +0530 @@ -0,0 +1,259 @@ +Memory Controller + +Salient features + +a. Enable control of both RSS (mapped) and Page Cache (unmapped) pages +b. The infrastructure allows easy addition of other types of memory to control +c. Provides *zero overhead* for non memory controller users +d. Provides a double LRU: global memory pressure causes reclaim from the + global LRU; a container on hitting a limit, reclaims from the per + container LRU + +NOTE: Page Cache (unmapped) also includes Swap Cache pages as a subset +and will not be referred to explicitly in the rest of the documentation. + +Benefits and Purpose of the memory controller + +The memory controller isolates the memory behaviour of a group of tasks +from the rest of the system. The article on LWN [12] mentions some probable +uses of the memory controller. The memory controller can be used to + +a. Isolate an application or a group of applications + Memory hungry applications can be isolated and limited to a smaller + amount of memory. +b. Create a container with limited amount of memory, this can be used + as a good alternative to booting with mem=XXXX. +c. Virtualization solutions can control the amount of memory they want + to assign to a virtual machine instance. +d. A CD/DVD burner could control the amount of memory used b…
creator: Balbir Singh
date: 2007-08-24T15:21:37-00:00

Re: [-mm PATCH 5/10] Memory controller task migration (v7)
type: item
description: > Allow tasks to migrate from one container to the other. We migrate > mm_struct's mem_container only when the thread group id migrates. > + /* > + * Only thread group leaders are allowed to migrate, the mm_struct is > + * in effect owned by the leader > + */ > + if (p->tgid != p->pid) > + goto out; does it mean that you can't move a process between containers once its thread group leader exited? YAMAMOTO Takashi _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: yamamoto
date: 2007-08-27T08:26:35-00:00

Re: [-mm PATCH 5/10] Memory controller task migration (v7)
type: item
description: YAMAMOTO Takashi wrote: >> Allow tasks to migrate from one container to the other. We migrate >> mm_struct's mem_container only when the thread group id migrates. > >> + /* >> + * Only thread group leaders are allowed to migrate, the mm_struct is >> + * in effect owned by the leader >> + */ >> + if (p->tgid != p->pid) >> + goto out; > > does it mean that you can't move a process between containers > once its thread group leader exited? > > YAMAMOTO Takashi Hi, Good catch! Currently, we treat the mm as owned by the thread group leader. But this policy can be easily adapted to any other desired policy. Would you like to see it change to something else? -- Warm Regards, Balbir Singh Linux Technology Center IBM, ISTL _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: Balbir Singh
date: 2007-08-27T10:39:15-00:00

Re: [-mm PATCH 5/10] Memory controller task migration (v7)
type: item
description: > YAMAMOTO Takashi wrote: > >> Allow tasks to migrate from one container to the other. We migrate > >> mm_struct's mem_container only when the thread group id migrates. > > > >> + /* > >> + * Only thread group leaders are allowed to migrate, the mm_struct is > >> + * in effect owned by the leader > >> + */ > >> + if (p->tgid != p->pid) > >> + goto out; > > > > does it mean that you can't move a process between containers > > once its thread group leader exited? > > > > YAMAMOTO Takashi > > > Hi, > > Good catch! Currently, we treat the mm as owned by the thread group leader. > But this policy can be easily adapted to any other desired policy. > Would you like to see it change to something else? > > -- > Warm Regards, > Balbir Singh > Linux Technology Center > IBM, ISTL although i have no good idea right now, something which allows to move a process with its thread group leader dead would be better. YAMAMOTO Takashi _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/containers
creator: yamamoto
date: 2007-08-28T08:32:52-00:00

Re: [-mm PATCH 5/10] Memory controller task migration (v7)
type: item
description: On 8/28/07, YAMAMOTO Takashi <yamamoto@valinux.co.jp> wrote: > > although i have no good idea right now, something which allows > to move a process with its thread group leader dead would be better. > One way I was thinking of approaching this problem was slightly different: - every mm always has an "owning" task. Initially that will be the thread that creates the mm - if the owning thread exits or execs and *isn't* the last user of the mm, then we may need to find a new owner for the mm: 1) My guess is that typically the thread that created the mm will also be the last user of the mm - if this is the case, then in the normal case we don't need to find a new owner. 2) If we do need a new owner, first look amongst the other threads in the process (cheap, should find another user of the mm quickly) 3) next look in the child and parent threads (more expensive, but rarer) 4) if necessary, scan the entire thread list (expensive, but should never be needed in general use) The advantage of this is that we don't then need to have a memory container pointer in the mm - we can just use the memory container of the mm's owner. With just a single container type needing to be tied to an mm, this isn't a huge advantage since we're just replacing one pointer (memory container) with another (owning task) and have similar levels of complexity for both. But if we have multiple container subsystems that need to be tied to a particular mm then they can both use the mm owner pointer. E.g. I want to add a swap container subsystem that restricts which swap devices a group of processes can swap to, and how many pages they can put into swap. And I want to be able to run this independently of the in-memory page accounting subsystem. Having a task owner pointer in the mm allows these to be indpendent subsystems, and (I believe) isn't any more complex than the work involved to support moving an mm whose thread group leader has exited or execd. Paul ______________________________________________…
creator: Paul Menage
date: 2007-08-28T20:04:34-00:00