Skip to contentSkip to conversation

minor slabinfo cleanup

PATCH New Brian Gerst 1 participant 1 message Jul 31, 2002 Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 minor slabinfo cleanup

This patch removes the use of a magic pointer value to print the slabinfo version header. Resend against latest BK snapshot.

Signature · 1 line
				Brian Gerst
mm/slab.c +15 -21
diff -urN linux-bk/mm/slab.c linux/mm/slab.c
@@ -1904,10 +1904,22 @@
 	struct list_head *p;
 
 	down(&cache_chain_sem);
-	if (!n)
-		return (void *)1;
+	if (!n) {
+		/*
+		 * Output format version, so at least we can change it
+		 * without _too_ many complaints.
+		 */
+		seq_puts(m, "slabinfo - version: 1.1"
+#if STATS
+				" (statistics)"
+#endif
+#ifdef CONFIG_SMP
+				" (SMP)"
+#endif
+				"\n");
+	};
 	p = &cache_cache.next;
-	while (--n) {
+	while (n--) {
 		p = p->next;
 		if (p == &cache_cache.next)
 			return NULL;
@@ -1919,8 +1931,6 @@
 {
 	kmem_cache_t *cachep = p;
 	++*pos;
-	if (p == (void *)1)
-		return &cache_cache;
 	cachep = list_entry(cachep->next.next, kmem_cache_t, next);
 	return cachep == &cache_cache ? NULL : cachep;
 }
@@ -1941,22 +1951,6 @@
 	unsigned long	num_slabs;
 	const char *name; 
 
-	if (p == (void*)1) {
-		/*
-		 * Output format version, so at least we can change it
-		 * without _too_ many complaints.
-		 */
-		seq_puts(m, "slabinfo - version: 1.1"
-#if STATS
-				" (statistics)"
-#endif
-#ifdef CONFIG_SMP
-				" (SMP)"
-#endif
-				"\n");
-		return 0;
-	}
-
 	spin_lock_irq(&cachep->spinlock);
 	active_objs = 0;
 	num_slabs = 0;