/*
  * A lot of the calls to the cache allocation functions are expected to be
- * inlined by the compiler. Since the calls to memcg_kmem_get_cache are
+ * inlined by the compiler. Since the calls to memcg_slab_pre_alloc_hook() are
  * conditional to this static branch, we'll have to allow modules that does
  * kmem_cache_alloc and the such to see this symbol as well
  */
        ida_simple_remove(&memcg_cache_ida, id);
 }
 
-/**
- * memcg_kmem_get_cache: select memcg or root cache for allocation
- * @cachep: the original global kmem cache
- *
- * Return the kmem_cache we're supposed to use for a slab allocation.
- *
- * If the cache does not exist yet, if we are the first user of it, we
- * create it asynchronously in a workqueue and let the current allocation
- * go through with the original cache.
- */
-struct kmem_cache *memcg_kmem_get_cache(struct kmem_cache *cachep)
-{
-       struct kmem_cache *memcg_cachep;
-
-       memcg_cachep = READ_ONCE(cachep->memcg_params.memcg_cache);
-       if (unlikely(!memcg_cachep)) {
-               queue_work(system_wq, &cachep->memcg_params.work);
-               return cachep;
-       }
-
-       return memcg_cachep;
-}
-
 /**
  * __memcg_kmem_charge: charge a number of kernel pages to a memcg
  * @memcg: memory cgroup to charge
 
        if (memcg_kmem_bypass())
                return s;
 
-       cachep = memcg_kmem_get_cache(s);
-       if (is_root_cache(cachep))
+       cachep = READ_ONCE(s->memcg_params.memcg_cache);
+       if (unlikely(!cachep)) {
+               /*
+                * If memcg cache does not exist yet, we schedule it's
+                * asynchronous creation and let the current allocation
+                * go through with the root cache.
+                */
+               queue_work(system_wq, &s->memcg_params.work);
                return s;
+       }
 
        objcg = get_obj_cgroup_from_current();
        if (!objcg)
 
        }
 
        /*
-        * Since readers won't lock (see memcg_kmem_get_cache()), we need a
+        * Since readers won't lock (see memcg_slab_pre_alloc_hook()), we need a
         * barrier here to ensure nobody will see the kmem_cache partially
         * initialized.
         */