*
  * @memcg_cache: pointer to memcg kmem cache, used by all non-root memory
  *             cgroups.
- * @root_caches_node: list node for slab_root_caches list.
  * @work: work struct used to create the non-root cache.
  */
 struct memcg_cache_params {
        struct kmem_cache *root_cache;
 
        struct kmem_cache *memcg_cache;
-       struct list_head __root_caches_node;
        struct work_struct work;
 };
 #endif /* CONFIG_SLOB */
 }
 
 #ifdef CONFIG_MEMCG_KMEM
-
-/* List of all root caches. */
-extern struct list_head                slab_root_caches;
-#define root_caches_node       memcg_params.__root_caches_node
-
 static inline bool is_root_cache(struct kmem_cache *s)
 {
        return !s->memcg_params.root_cache;
 }
 
 extern void slab_init_memcg_params(struct kmem_cache *);
-extern void memcg_link_cache(struct kmem_cache *s);
 
 #else /* CONFIG_MEMCG_KMEM */
-
-/* If !memcg, all caches are root. */
-#define slab_root_caches       slab_caches
-#define root_caches_node       list
-
 static inline bool is_root_cache(struct kmem_cache *s)
 {
        return true;
 {
 }
 
-static inline void memcg_link_cache(struct kmem_cache *s)
-{
-}
-
 #endif /* CONFIG_MEMCG_KMEM */
 
 static inline struct kmem_cache *virt_to_cache(const void *obj)
 
 }
 
 #ifdef CONFIG_MEMCG_KMEM
-
-LIST_HEAD(slab_root_caches);
-
 static void memcg_kmem_cache_create_func(struct work_struct *work)
 {
        struct kmem_cache *cachep = container_of(work, struct kmem_cache,
        else
                slab_init_memcg_params(s);
 }
-
-void memcg_link_cache(struct kmem_cache *s)
-{
-       if (is_root_cache(s))
-               list_add(&s->root_caches_node, &slab_root_caches);
-}
-
-static void memcg_unlink_cache(struct kmem_cache *s)
-{
-       if (is_root_cache(s))
-               list_del(&s->root_caches_node);
-}
 #else
 static inline void init_memcg_params(struct kmem_cache *s,
                                     struct kmem_cache *root_cache)
 {
 }
-
-static inline void memcg_unlink_cache(struct kmem_cache *s)
-{
-}
 #endif /* CONFIG_MEMCG_KMEM */
 
 /*
        if (flags & SLAB_NEVER_MERGE)
                return NULL;
 
-       list_for_each_entry_reverse(s, &slab_root_caches, root_caches_node) {
+       list_for_each_entry_reverse(s, &slab_caches, list) {
                if (slab_unmergeable(s))
                        continue;
 
 
        s->refcount = 1;
        list_add(&s->list, &slab_caches);
-       memcg_link_cache(s);
 out:
        if (err)
                return ERR_PTR(err);
        if (__kmem_cache_shutdown(s) != 0)
                return -EBUSY;
 
-       memcg_unlink_cache(s);
        list_del(&s->list);
 
        if (s->flags & SLAB_TYPESAFE_BY_RCU) {
 
        create_boot_cache(s, name, size, flags, useroffset, usersize);
        list_add(&s->list, &slab_caches);
-       memcg_link_cache(s);
        s->refcount = 1;
        return s;
 }
 void *slab_start(struct seq_file *m, loff_t *pos)
 {
        mutex_lock(&slab_mutex);
-       return seq_list_start(&slab_root_caches, *pos);
+       return seq_list_start(&slab_caches, *pos);
 }
 
 void *slab_next(struct seq_file *m, void *p, loff_t *pos)
 {
-       return seq_list_next(p, &slab_root_caches, pos);
+       return seq_list_next(p, &slab_caches, pos);
 }
 
 void slab_stop(struct seq_file *m, void *p)
 
 static int slab_show(struct seq_file *m, void *p)
 {
-       struct kmem_cache *s = list_entry(p, struct kmem_cache, root_caches_node);
+       struct kmem_cache *s = list_entry(p, struct kmem_cache, list);
 
-       if (p == slab_root_caches.next)
+       if (p == slab_caches.next)
                print_slabinfo_header(m);
-       cache_show(s, m);
+       if (is_root_cache(s))
+               cache_show(s, m);
        return 0;
 }
 
        mutex_lock(&slab_mutex);
        seq_puts(m, "# <name> <css_id[:dead|deact]> <active_objs> <num_objs>");
        seq_puts(m, " <active_slabs> <num_slabs>\n");
-       list_for_each_entry(s, &slab_root_caches, root_caches_node) {
+       list_for_each_entry(s, &slab_caches, list) {
                /*
                 * Skip kmem caches that don't have the memcg cache.
                 */