aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/memcontrol.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 0de26691f0f5..47559cc0cdcc 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2152,6 +2152,8 @@ struct memcg_kmem_cache_create_work {
2152 struct work_struct work; 2152 struct work_struct work;
2153}; 2153};
2154 2154
2155static struct workqueue_struct *memcg_kmem_cache_create_wq;
2156
2155static void memcg_kmem_cache_create_func(struct work_struct *w) 2157static void memcg_kmem_cache_create_func(struct work_struct *w)
2156{ 2158{
2157 struct memcg_kmem_cache_create_work *cw = 2159 struct memcg_kmem_cache_create_work *cw =
@@ -2183,7 +2185,7 @@ static void __memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg,
2183 cw->cachep = cachep; 2185 cw->cachep = cachep;
2184 INIT_WORK(&cw->work, memcg_kmem_cache_create_func); 2186 INIT_WORK(&cw->work, memcg_kmem_cache_create_func);
2185 2187
2186 schedule_work(&cw->work); 2188 queue_work(memcg_kmem_cache_create_wq, &cw->work);
2187} 2189}
2188 2190
2189static void memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg, 2191static void memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg,
@@ -5786,6 +5788,17 @@ static int __init mem_cgroup_init(void)
5786{ 5788{
5787 int cpu, node; 5789 int cpu, node;
5788 5790
5791#ifndef CONFIG_SLOB
5792 /*
5793 * Kmem cache creation is mostly done with the slab_mutex held,
5794 * so use a special workqueue to avoid stalling all worker
5795 * threads in case lots of cgroups are created simultaneously.
5796 */
5797 memcg_kmem_cache_create_wq =
5798 alloc_ordered_workqueue("memcg_kmem_cache_create", 0);
5799 BUG_ON(!memcg_kmem_cache_create_wq);
5800#endif
5801
5789 hotcpu_notifier(memcg_cpu_hotplug_callback, 0); 5802 hotcpu_notifier(memcg_cpu_hotplug_callback, 0);
5790 5803
5791 for_each_possible_cpu(cpu) 5804 for_each_possible_cpu(cpu)