aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/controllers/memory.txt8
-rw-r--r--include/linux/cgroup_subsys.h2
-rw-r--r--include/linux/memcontrol.h4
-rw-r--r--include/linux/mm_types.h4
-rw-r--r--init/Kconfig30
-rw-r--r--mm/Makefile2
-rw-r--r--mm/oom_kill.c2
-rw-r--r--mm/vmscan.c4
8 files changed, 30 insertions, 26 deletions
diff --git a/Documentation/controllers/memory.txt b/Documentation/controllers/memory.txt
index fba6af45225c..866b9cd9a959 100644
--- a/Documentation/controllers/memory.txt
+++ b/Documentation/controllers/memory.txt
@@ -1,4 +1,8 @@
1Memory Controller 1Memory Resource Controller
2
3NOTE: The Memory Resource Controller has been generically been referred
4to as the memory controller in this document. Do not confuse memory controller
5used here with the memory controller that is used in hardware.
2 6
3Salient features 7Salient features
4 8
@@ -152,7 +156,7 @@ The memory controller uses the following hierarchy
152 156
153a. Enable CONFIG_CGROUPS 157a. Enable CONFIG_CGROUPS
154b. Enable CONFIG_RESOURCE_COUNTERS 158b. Enable CONFIG_RESOURCE_COUNTERS
155c. Enable CONFIG_CGROUP_MEM_CONT 159c. Enable CONFIG_CGROUP_MEM_RES_CTLR
156 160
1571. Prepare the cgroups 1611. Prepare the cgroups
158# mkdir -p /cgroups 162# mkdir -p /cgroups
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index ac6aad98b607..1ddebfc52565 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -37,7 +37,7 @@ SUBSYS(cpuacct)
37 37
38/* */ 38/* */
39 39
40#ifdef CONFIG_CGROUP_MEM_CONT 40#ifdef CONFIG_CGROUP_MEM_RES_CTLR
41SUBSYS(mem_cgroup) 41SUBSYS(mem_cgroup)
42#endif 42#endif
43 43
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 04075628cb9a..a8be8073b9e6 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -25,7 +25,7 @@ struct page_cgroup;
25struct page; 25struct page;
26struct mm_struct; 26struct mm_struct;
27 27
28#ifdef CONFIG_CGROUP_MEM_CONT 28#ifdef CONFIG_CGROUP_MEM_RES_CTLR
29 29
30extern void mm_init_cgroup(struct mm_struct *mm, struct task_struct *p); 30extern void mm_init_cgroup(struct mm_struct *mm, struct task_struct *p);
31extern void mm_free_cgroup(struct mm_struct *mm); 31extern void mm_free_cgroup(struct mm_struct *mm);
@@ -72,7 +72,7 @@ extern long mem_cgroup_calc_reclaim_active(struct mem_cgroup *mem,
72extern long mem_cgroup_calc_reclaim_inactive(struct mem_cgroup *mem, 72extern long mem_cgroup_calc_reclaim_inactive(struct mem_cgroup *mem,
73 struct zone *zone, int priority); 73 struct zone *zone, int priority);
74 74
75#else /* CONFIG_CGROUP_MEM_CONT */ 75#else /* CONFIG_CGROUP_MEM_RES_CTLR */
76static inline void mm_init_cgroup(struct mm_struct *mm, 76static inline void mm_init_cgroup(struct mm_struct *mm,
77 struct task_struct *p) 77 struct task_struct *p)
78{ 78{
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 34023c65d466..af190ceab971 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -88,7 +88,7 @@ struct page {
88 void *virtual; /* Kernel virtual address (NULL if 88 void *virtual; /* Kernel virtual address (NULL if
89 not kmapped, ie. highmem) */ 89 not kmapped, ie. highmem) */
90#endif /* WANT_PAGE_VIRTUAL */ 90#endif /* WANT_PAGE_VIRTUAL */
91#ifdef CONFIG_CGROUP_MEM_CONT 91#ifdef CONFIG_CGROUP_MEM_RES_CTLR
92 unsigned long page_cgroup; 92 unsigned long page_cgroup;
93#endif 93#endif
94}; 94};
@@ -222,7 +222,7 @@ struct mm_struct {
222 /* aio bits */ 222 /* aio bits */
223 rwlock_t ioctx_list_lock; 223 rwlock_t ioctx_list_lock;
224 struct kioctx *ioctx_list; 224 struct kioctx *ioctx_list;
225#ifdef CONFIG_CGROUP_MEM_CONT 225#ifdef CONFIG_CGROUP_MEM_RES_CTLR
226 struct mem_cgroup *mem_cgroup; 226 struct mem_cgroup *mem_cgroup;
227#endif 227#endif
228}; 228};
diff --git a/init/Kconfig b/init/Kconfig
index f698a5af5007..442850b984be 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -366,6 +366,21 @@ config RESOURCE_COUNTERS
366 infrastructure that works with cgroups 366 infrastructure that works with cgroups
367 depends on CGROUPS 367 depends on CGROUPS
368 368
369config CGROUP_MEM_RES_CTLR
370 bool "Memory Resource Controller for Control Groups"
371 depends on CGROUPS && RESOURCE_COUNTERS
372 help
373 Provides a memory resource controller that manages both page cache and
374 RSS memory.
375
376 Note that setting this option increases fixed memory overhead
377 associated with each page of memory in the system by 4/8 bytes
378 and also increases cache misses because struct page on many 64bit
379 systems will not fit into a single cache line anymore.
380
381 Only enable when you're ok with these trade offs and really
382 sure you need the memory resource controller.
383
369config SYSFS_DEPRECATED 384config SYSFS_DEPRECATED
370 bool "Create deprecated sysfs files" 385 bool "Create deprecated sysfs files"
371 depends on SYSFS 386 depends on SYSFS
@@ -387,21 +402,6 @@ config SYSFS_DEPRECATED
387 If you are using a distro that was released in 2006 or later, 402 If you are using a distro that was released in 2006 or later,
388 it should be safe to say N here. 403 it should be safe to say N here.
389 404
390config CGROUP_MEM_CONT
391 bool "Memory controller for cgroups"
392 depends on CGROUPS && RESOURCE_COUNTERS
393 help
394 Provides a memory controller that manages both page cache and
395 RSS memory.
396
397 Note that setting this option increases fixed memory overhead
398 associated with each page of memory in the system by 4/8 bytes
399 and also increases cache misses because struct page on many 64bit
400 systems will not fit into a single cache line anymore.
401
402 Only enable when you're ok with these trade offs and really
403 sure you need the memory controller.
404
405config PROC_PID_CPUSET 405config PROC_PID_CPUSET
406 bool "Include legacy /proc/<pid>/cpuset file" 406 bool "Include legacy /proc/<pid>/cpuset file"
407 depends on CPUSETS 407 depends on CPUSETS
diff --git a/mm/Makefile b/mm/Makefile
index 9f117bab5322..a5b0dd93427a 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -32,5 +32,5 @@ obj-$(CONFIG_FS_XIP) += filemap_xip.o
32obj-$(CONFIG_MIGRATION) += migrate.o 32obj-$(CONFIG_MIGRATION) += migrate.o
33obj-$(CONFIG_SMP) += allocpercpu.o 33obj-$(CONFIG_SMP) += allocpercpu.o
34obj-$(CONFIG_QUICKLIST) += quicklist.o 34obj-$(CONFIG_QUICKLIST) += quicklist.o
35obj-$(CONFIG_CGROUP_MEM_CONT) += memcontrol.o 35obj-$(CONFIG_CGROUP_MEM_RES_CTLR) += memcontrol.o
36 36
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 4194b9db0104..44b2da11bf43 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -412,7 +412,7 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
412 return oom_kill_task(p); 412 return oom_kill_task(p);
413} 413}
414 414
415#ifdef CONFIG_CGROUP_MEM_CONT 415#ifdef CONFIG_CGROUP_MEM_RES_CTLR
416void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask) 416void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask)
417{ 417{
418 unsigned long points = 0; 418 unsigned long points = 0;
diff --git a/mm/vmscan.c b/mm/vmscan.c
index a26dabd62fed..106ba10e1ac6 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -126,7 +126,7 @@ long vm_total_pages; /* The total number of pages which the VM controls */
126static LIST_HEAD(shrinker_list); 126static LIST_HEAD(shrinker_list);
127static DECLARE_RWSEM(shrinker_rwsem); 127static DECLARE_RWSEM(shrinker_rwsem);
128 128
129#ifdef CONFIG_CGROUP_MEM_CONT 129#ifdef CONFIG_CGROUP_MEM_RES_CTLR
130#define scan_global_lru(sc) (!(sc)->mem_cgroup) 130#define scan_global_lru(sc) (!(sc)->mem_cgroup)
131#else 131#else
132#define scan_global_lru(sc) (1) 132#define scan_global_lru(sc) (1)
@@ -1427,7 +1427,7 @@ unsigned long try_to_free_pages(struct zone **zones, int order, gfp_t gfp_mask)
1427 return do_try_to_free_pages(zones, gfp_mask, &sc); 1427 return do_try_to_free_pages(zones, gfp_mask, &sc);
1428} 1428}
1429 1429
1430#ifdef CONFIG_CGROUP_MEM_CONT 1430#ifdef CONFIG_CGROUP_MEM_RES_CTLR
1431 1431
1432unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont, 1432unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
1433 gfp_t gfp_mask) 1433 gfp_t gfp_mask)