summaryrefslogtreecommitdiff
path: root/mm/slab.h
diff options
context:
space:
mode:
authorRoman Gushchin <guro@fb.com>2020-08-07 09:21:14 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2020-08-07 21:33:25 +0300
commitd797b7d05405c519f7b62ea69a75cea1883863b2 (patch)
treebde6e51a3ed167942db2785a5a30ba310a561181 /mm/slab.h
parent9855609bde03e2472b99a95e869d29ee1e78a751 (diff)
downloadlinux-d797b7d05405c519f7b62ea69a75cea1883863b2.tar.xz
mm: memcg/slab: simplify memcg cache creation
Because the number of non-root kmem_caches doesn't depend on the number of memory cgroups anymore and is generally not very big, there is no more need for a dedicated workqueue. Also, as there is no more need to pass any arguments to the memcg_create_kmem_cache() except the root kmem_cache, it's possible to just embed the work structure into the kmem_cache and avoid the dynamic allocation of the work structure. This will also simplify the synchronization: for each root kmem_cache there is only one work. So there will be no more concurrent attempts to create a non-root kmem_cache for a root kmem_cache: the second and all following attempts to queue the work will fail. On the kmem_cache destruction path there is no more need to call the expensive flush_workqueue() and wait for all pending works to be finished. Instead, cancel_work_sync() can be used to cancel/wait for only one work. 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-14-guro@fb.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/slab.h')
-rw-r--r--mm/slab.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/slab.h b/mm/slab.h
index e716b80befc2..fd9fcdfb3789 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -45,12 +45,14 @@ struct kmem_cache {
* @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 */