1
0

mm: memcg/slab: remove memcg_kmem_get_cache()

The memcg_kmem_get_cache() function became really trivial, so let's just
inline it into the single call point: memcg_slab_pre_alloc_hook().

It will make the code less bulky and can also help the compiler to
generate a better code.

Signed-off-by: Roman Gushchin <guro@fb.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Link: http://lkml.kernel.org/r/20200623174037.3951353-15-guro@fb.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Este cometimento está contido em:
Roman Gushchin
2020-08-06 23:21:17 -07:00
cometido por Linus Torvalds
ascendente d797b7d054
cometimento 272911a4ad
4 ficheiros modificados com 11 adições e 29 eliminações

Ver ficheiro

@@ -365,9 +365,16 @@ static inline struct kmem_cache *memcg_slab_pre_alloc_hook(struct kmem_cache *s,
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)