]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - mm/memcontrol.c
Merge tag 'mac80211-for-davem-2017-02-28' of git://git.kernel.org/pub/scm/linux/kerne...
[karo-tx-linux.git] / mm / memcontrol.c
index b822e158b319e8f2f02ecbfe76c31b6466be51f1..45867e439d31d7f9836769463cad10b170180558 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/memcontrol.h>
 #include <linux/cgroup.h>
 #include <linux/mm.h>
+#include <linux/shmem_fs.h>
 #include <linux/hugetlb.h>
 #include <linux/pagemap.h>
 #include <linux/smp.h>
@@ -317,6 +318,8 @@ void memcg_put_cache_ids(void)
 DEFINE_STATIC_KEY_FALSE(memcg_kmem_enabled_key);
 EXPORT_SYMBOL(memcg_kmem_enabled_key);
 
+struct workqueue_struct *memcg_kmem_cache_wq;
+
 #endif /* !CONFIG_SLOB */
 
 /**
@@ -2143,8 +2146,6 @@ struct memcg_kmem_cache_create_work {
        struct work_struct work;
 };
 
-static struct workqueue_struct *memcg_kmem_cache_create_wq;
-
 static void memcg_kmem_cache_create_func(struct work_struct *w)
 {
        struct memcg_kmem_cache_create_work *cw =
@@ -2176,7 +2177,7 @@ static void __memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg,
        cw->cachep = cachep;
        INIT_WORK(&cw->work, memcg_kmem_cache_create_func);
 
-       queue_work(memcg_kmem_cache_create_wq, &cw->work);
+       queue_work(memcg_kmem_cache_wq, &cw->work);
 }
 
 static void memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg,
@@ -2837,6 +2838,7 @@ static int memcg_online_kmem(struct mem_cgroup *memcg)
         */
        memcg->kmemcg_id = memcg_id;
        memcg->kmem_state = KMEM_ONLINE;
+       INIT_LIST_HEAD(&memcg->kmem_caches);
 
        return 0;
 }
@@ -4002,9 +4004,9 @@ static struct cftype mem_cgroup_legacy_files[] = {
 #ifdef CONFIG_SLABINFO
        {
                .name = "kmem.slabinfo",
-               .seq_start = slab_start,
-               .seq_next = slab_next,
-               .seq_stop = slab_stop,
+               .seq_start = memcg_slab_start,
+               .seq_next = memcg_slab_next,
+               .seq_stop = memcg_slab_stop,
                .seq_show = memcg_slab_show,
        },
 #endif
@@ -5777,12 +5779,12 @@ static int __init mem_cgroup_init(void)
 #ifndef CONFIG_SLOB
        /*
         * Kmem cache creation is mostly done with the slab_mutex held,
-        * so use a special workqueue to avoid stalling all worker
-        * threads in case lots of cgroups are created simultaneously.
+        * so use a workqueue with limited concurrency to avoid stalling
+        * all worker threads in case lots of cgroups are created and
+        * destroyed simultaneously.
         */
-       memcg_kmem_cache_create_wq =
-               alloc_ordered_workqueue("memcg_kmem_cache_create", 0);
-       BUG_ON(!memcg_kmem_cache_create_wq);
+       memcg_kmem_cache_wq = alloc_workqueue("memcg_kmem_cache", 0, 1);
+       BUG_ON(!memcg_kmem_cache_wq);
 #endif
 
        cpuhp_setup_state_nocalls(CPUHP_MM_MEMCQ_DEAD, "mm/memctrl:dead", NULL,