[PATCH 1/4] slab common: Add functions for kmem_cache_node access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



These functions allow to eliminate repeatedly used code in both
SLAB and SLUB and also allow for the insertion of debugging code
that may be needed in the development process.

Signed-off-by: Christoph Lameter <cl@xxxxxxxxx>

Index: linux/mm/slab.h
===================================================================
--- linux.orig/mm/slab.h	2014-05-30 13:12:01.444370238 -0500
+++ linux/mm/slab.h	2014-05-30 13:12:01.444370238 -0500
@@ -288,5 +288,14 @@ struct kmem_cache_node {
 
 };
 
+static inline struct kmem_cache_node *get_node(struct kmem_cache *s, int node)
+{
+	return s->node[node];
+}
+
+#define for_each_kmem_cache_node(s, node, n) \
+	for (node = 0; n = get_node(s, node), node < nr_node_ids; node++) \
+		 if (n)
+
 void *slab_next(struct seq_file *m, void *p, loff_t *pos);
 void slab_stop(struct seq_file *m, void *p);
Index: linux/mm/slub.c
===================================================================
--- linux.orig/mm/slub.c	2014-05-30 13:10:55.000000000 -0500
+++ linux/mm/slub.c	2014-05-30 13:12:12.628022255 -0500
@@ -233,11 +233,6 @@ static inline void stat(const struct kme
  * 			Core slab cache functions
  *******************************************************************/
 
-static inline struct kmem_cache_node *get_node(struct kmem_cache *s, int node)
-{
-	return s->node[node];
-}
-
 /* Verify that a pointer has an address that is valid within a slab page */
 static inline int check_valid_pointer(struct kmem_cache *s,
 				struct page *page, const void *object)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]