summaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index bb894b071f59..604eddc58665 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2296,6 +2296,17 @@ static void drain_local_stock(struct work_struct *dummy)
2296 clear_bit(FLUSHING_CACHED_CHARGE, &stock->flags); 2296 clear_bit(FLUSHING_CACHED_CHARGE, &stock->flags);
2297} 2297}
2298 2298
2299static void __init memcg_stock_init(void)
2300{
2301 int cpu;
2302
2303 for_each_possible_cpu(cpu) {
2304 struct memcg_stock_pcp *stock =
2305 &per_cpu(memcg_stock, cpu);
2306 INIT_WORK(&stock->work, drain_local_stock);
2307 }
2308}
2309
2299/* 2310/*
2300 * Cache charges(val) which is from res_counter, to local per_cpu area. 2311 * Cache charges(val) which is from res_counter, to local per_cpu area.
2301 * This will be consumed by consume_stock() function, later. 2312 * This will be consumed by consume_stock() function, later.
@@ -6092,15 +6103,7 @@ mem_cgroup_css_alloc(struct cgroup *cont)
6092 6103
6093 /* root ? */ 6104 /* root ? */
6094 if (cont->parent == NULL) { 6105 if (cont->parent == NULL) {
6095 int cpu;
6096
6097 root_mem_cgroup = memcg; 6106 root_mem_cgroup = memcg;
6098 for_each_possible_cpu(cpu) {
6099 struct memcg_stock_pcp *stock =
6100 &per_cpu(memcg_stock, cpu);
6101 INIT_WORK(&stock->work, drain_local_stock);
6102 }
6103
6104 res_counter_init(&memcg->res, NULL); 6107 res_counter_init(&memcg->res, NULL);
6105 res_counter_init(&memcg->memsw, NULL); 6108 res_counter_init(&memcg->memsw, NULL);
6106 res_counter_init(&memcg->kmem, NULL); 6109 res_counter_init(&memcg->kmem, NULL);
@@ -6837,6 +6840,7 @@ static int __init mem_cgroup_init(void)
6837 hotcpu_notifier(memcg_cpu_hotplug_callback, 0); 6840 hotcpu_notifier(memcg_cpu_hotplug_callback, 0);
6838 enable_swap_cgroup(); 6841 enable_swap_cgroup();
6839 mem_cgroup_soft_limit_tree_init(); 6842 mem_cgroup_soft_limit_tree_init();
6843 memcg_stock_init();
6840 return 0; 6844 return 0;
6841} 6845}
6842subsys_initcall(mem_cgroup_init); 6846subsys_initcall(mem_cgroup_init);