All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] minor slabinfo cleanup
@ 2002-07-09 22:47 Brian Gerst
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Gerst @ 2002-07-09 22:47 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux-Kernel

[-- Attachment #1: Type: text/plain, Size: 111 bytes --]

This patch removes the use of a magic pointer value to print the 
slabinfo version header.

--
				Brian Gerst

[-- Attachment #2: slabinfo-1 --]
[-- Type: text/plain, Size: 1284 bytes --]

diff -urN linux-2.5.25/mm/slab.c linux/mm/slab.c
--- linux-2.5.25/mm/slab.c	Mon Jul  8 14:00:33 2002
+++ linux/mm/slab.c	Mon Jul  8 14:10:36 2002
@@ -1885,10 +1885,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;
@@ -1900,8 +1912,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;
 }
@@ -1922,22 +1932,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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] minor slabinfo cleanup
@ 2002-07-31  1:58 Brian Gerst
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Gerst @ 2002-07-31  1:58 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux-Kernel

[-- Attachment #1: Type: text/plain, Size: 147 bytes --]

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

-- 
				Brian Gerst

[-- Attachment #2: slabinfo-2 --]
[-- Type: text/plain, Size: 1276 bytes --]

diff -urN linux-bk/mm/slab.c linux/mm/slab.c
--- linux-bk/mm/slab.c	Tue Jul 30 20:59:28 2002
+++ linux/mm/slab.c	Tue Jul 30 21:56:02 2002
@@ -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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-07-31  2:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-09 22:47 [PATCH] minor slabinfo cleanup Brian Gerst
2002-07-31  1:58 Brian Gerst

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.