mm: print swapcache page count in show_swap_cache_info()
Johannes Weiner [Sat, 26 Jul 2008 02:46:01 +0000 (19:46 -0700)]
Every arch implements its own show_mem() function.  Most of them share
quite some code, some of them are completely identical.

This series implements a generic version of this function and migrates
almost all architectures to it.

This patch:

Most show_mem() implementations calculate the amount of pages within
the swapcache every time.  Move the output to a more appropriate place
and use the anyway available total_swapcache_pages variable.

Signed-off-by: Johannes Weiner <>
Cc: Richard Henderson <>
Cc: Ivan Kokshaysky <>
Cc: Haavard Skinnemoen <>
Cc: Bryan Wu <>
Cc: Chris Zankel <>
Cc: Ingo Molnar <>
Cc: Jeff Dike <>
Cc: David S. Miller <>
Cc: Paul Mundt <>
Cc: Heiko Carstens <>
Cc: Martin Schwidefsky <>
Cc: David Howells <>
Cc: Benjamin Herrenschmidt <>
Cc: Paul Mackerras <>
Cc: Yoshinori Sato <>
Cc: Ralf Baechle <>
Cc: Greg Ungerer <>
Cc: Geert Uytterhoeven <>
Cc: Roman Zippel <>
Cc: Hirokazu Takata <>
Cc: Mikael Starvik <>
Cc: Hugh Dickins <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>


index 2c217e3..b8035b0 100644 (file)
@@ -56,7 +56,8 @@ static struct {
 void show_swap_cache_info(void)
-       printk("Swap cache: add %lu, delete %lu, find %lu/%lu\n",
+       printk("%lu pages in swap cache\n", total_swapcache_pages);
+       printk("Swap cache stats: add %lu, delete %lu, find %lu/%lu\n",
                swap_cache_info.add_total, swap_cache_info.del_total,
                swap_cache_info.find_success, swap_cache_info.find_total);
        printk("Free swap  = %lukB\n", nr_swap_pages << (PAGE_SHIFT - 10));