[PATCH] minor slabinfo cleanup

From: Brian Gerst (bgerst@didntduck.org)
Date: Tue Jul 09 2002 - 17:47:21 EST


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

--
				Brian Gerst

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;

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jul 15 2002 - 22:00:16 EST