aboutsummaryrefslogtreecommitdiff
path: root/mm/slub.c
diff options
context:
space:
mode:
authorGravatar Vlastimil Babka <vbabka@suse.cz> 2023-10-03 14:57:49 +0200
committerGravatar Vlastimil Babka <vbabka@suse.cz> 2023-12-06 11:57:21 +0100
commitb52ef56e9b324b172053b03d8c775ef4708fbc23 (patch)
treefa6c1c55b4feadfdab97bb4a75c49d17ab371cec /mm/slub.c
parentmm/slab: move memcg related functions from slab.h to slub.c (diff)
downloadlinux-b52ef56e9b324b172053b03d8c775ef4708fbc23.tar.gz
linux-b52ef56e9b324b172053b03d8c775ef4708fbc23.tar.bz2
linux-b52ef56e9b324b172053b03d8c775ef4708fbc23.zip
mm/slab: move struct kmem_cache_node from slab.h to slub.c
The declaration and associated helpers are not used anywhere else anymore. Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: David Rientjes <rientjes@google.com> Tested-by: David Rientjes <rientjes@google.com> Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 844e0beb84ee..cc801f8258fe 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -397,6 +397,33 @@ static inline void stat(const struct kmem_cache *s, enum stat_item si)
}
/*
+ * The slab lists for all objects.
+ */
+struct kmem_cache_node {
+ spinlock_t list_lock;
+ unsigned long nr_partial;
+ struct list_head partial;
+#ifdef CONFIG_SLUB_DEBUG
+ atomic_long_t nr_slabs;
+ atomic_long_t total_objects;
+ struct list_head full;
+#endif
+};
+
+static inline struct kmem_cache_node *get_node(struct kmem_cache *s, int node)
+{
+ return s->node[node];
+}
+
+/*
+ * Iterator over all nodes. The body will be executed for each node that has
+ * a kmem_cache_node structure allocated (which is true for all online nodes)
+ */
+#define for_each_kmem_cache_node(__s, __node, __n) \
+ for (__node = 0; __node < nr_node_ids; __node++) \
+ if ((__n = get_node(__s, __node)))
+
+/*
* Tracks for which NUMA nodes we have kmem_cache_nodes allocated.
* Corresponds to node_state[N_NORMAL_MEMORY], but can temporarily
* differ during memory hotplug/hotremove operations.