linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC 00/21] Generic show_mem()
@ 2008-04-02 20:29 Johannes Weiner
  2008-04-02 20:29 ` [RFC 01/22] Generic show_mem() implementation Johannes Weiner
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Johannes Weiner @ 2008-04-02 20:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, mingo, davem, hskinnemoen, cooloney, starvik, dhowells,
	ysato, takata, geert, ralf, kyle, paulus, schwidefsky, lethal,
	jdike, miles, chris, rmk, tony.luck

Hi.

Every arch implements its own show_mem() function.  Most of them share
quite some code, some of them are completely identical.

This proposal implements a generic version of this functions and
migrates almost all architectures to use it.

I have only tested the x86_32 related part in lack of other archs.

As far as I understood the code, the generic version should work for
the architectures that used to iterate mem_map pfns, but I can not
tell for sure.  Please give feedback.

Also, this series leaves ia64, arm, and sparc as is.

Tony, as far as I understand, ia64 jumps holes in the memory map with
vmemmap_find_next_valid_pfn().  Any idea if and how this could be
built into the generic show_mem() version?

Russell, I don't know if arm can be transformed.  For now, it keeps
its arch-specific show_mem().

Dave, can sparc's version be simply migrated as well?

	Hannes

 arch/alpha/mm/init.c      |   30 ------------------
 arch/alpha/mm/numa.c      |   35 ----------------------
 arch/arm/mm/Kconfig       |    3 ++
 arch/avr32/mm/init.c      |   39 ------------------------
 arch/blackfin/mm/init.c   |   27 -----------------
 arch/cris/mm/init.c       |   31 -------------------
 arch/frv/mm/init.c        |   31 -------------------
 arch/h8300/mm/init.c      |   28 -----------------
 arch/ia64/Kconfig         |    3 ++
 arch/m32r/mm/init.c       |   37 -----------------------
 arch/m68k/mm/init.c       |   31 -------------------
 arch/m68knommu/mm/init.c  |   28 -----------------
 arch/mips/mm/Makefile     |    3 +-
 arch/mips/mm/pgtable.c    |   37 -----------------------
 arch/mn10300/mm/pgtable.c |   27 -----------------
 arch/parisc/mm/init.c     |   72 ---------------------------------------------
 arch/powerpc/mm/mem.c     |   40 -------------------------
 arch/ppc/mm/init.c        |   31 -------------------
 arch/s390/mm/init.c       |   36 ----------------------
 arch/sh/mm/init.c         |   41 -------------------------
 arch/sparc/Kconfig        |    3 ++
 arch/sparc64/mm/init.c    |   45 ----------------------------
 arch/um/kernel/mem.c      |   31 -------------------
 arch/v850/kernel/setup.c  |   30 ------------------
 arch/x86/mm/init_64.c     |   40 -------------------------
 arch/x86/mm/pgtable_32.c  |   48 ------------------------------
 arch/xtensa/mm/init.c     |   27 -----------------
 mm/page_alloc.c           |   53 +++++++++++++++++++++++++++++++++
 28 files changed, 63 insertions(+), 824 deletions(-)

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

* [RFC 01/22] Generic show_mem() implementation
  2008-04-02 20:29 [RFC 00/21] Generic show_mem() Johannes Weiner
@ 2008-04-02 20:29 ` Johannes Weiner
  2008-04-02 20:29 ` [RFC 02/22] x86: Use generic show_mem() Johannes Weiner
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Johannes Weiner @ 2008-04-02 20:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, mingo, davem, hskinnemoen, cooloney, starvik, dhowells,
	ysato, takata, geert, ralf, kyle, paulus, schwidefsky, lethal,
	jdike, miles, chris, rmk, tony.luck


Signed-off-by: Johannes Weiner <hannes@saeurebad.de>

diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 729cdbd..efffa92 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -598,6 +598,9 @@ config ALPHA_LARGE_VMALLOC
 
 	  Say N unless you know you need gobs and gobs of vmalloc space.
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 config VERBOSE_MCHECK
 	bool "Verbose Machine Checks"
 
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 76348f0..acad217 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -673,3 +673,6 @@ config OUTER_CACHE
 config CACHE_L2X0
 	bool
 	select OUTER_CACHE
+
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index c75d708..81e3360 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -146,6 +146,9 @@ source "kernel/Kconfig.preempt"
 config HAVE_ARCH_BOOTMEM_NODE
 	def_bool n
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 config ARCH_HAVE_MEMORY_PRESENT
 	def_bool n
 
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 589c6ac..a8cc977 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -526,6 +526,9 @@ config BFIN_SCRATCH_REG_CYCLES
 
 endchoice
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 endmenu
 
 
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 9389d38..217c658 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -108,6 +108,9 @@ config OOM_REBOOT
 
 source "kernel/Kconfig.preempt"
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 source mm/Kconfig
 
 endmenu
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index a5aac1b..c1a5aac 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -107,6 +107,9 @@ config HIGHPTE
 	  with a lot of RAM, this can be wasteful of precious low memory.
 	  Setting this option will put user-space page tables in high memory.
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 source "mm/Kconfig"
 
 choice
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 085dc6e..70e63fc 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -22,6 +22,9 @@ config ZONE_DMA
 	bool
 	default y
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 config FPU
 	bool
 	default n
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 8fa3faf..b178caa 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -431,6 +431,9 @@ config HAVE_ARCH_NODEDATA_EXTENSION
 	def_bool y
 	depends on NUMA
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 config IA32_SUPPORT
 	bool "Support for Linux/x86 binaries"
 	help
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index de153de..2f51d8f 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -225,6 +225,9 @@ config ARCH_DISCONTIGMEM_ENABLE
 	depends on CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP || CHIP_M32104
 	default y
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 source "mm/Kconfig"
 
 config IRAM_START
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 65db226..53b36a8 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -396,6 +396,9 @@ config NODES_SHIFT
 	default "3"
 	depends on !SINGLE_MEMORY_CHUNK
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 source "mm/Kconfig"
 
 endmenu
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index 07eb4c4..7e921a3 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -671,6 +671,9 @@ config ROMKERNEL
 
 endchoice
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 source "mm/Kconfig"
 
 endmenu
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 8724ed3..7c5a3c2 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1736,6 +1736,9 @@ config NODES_SHIFT
 	default "6"
 	depends on NEED_MULTIPLE_NODES
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 source "mm/Kconfig"
 
 config SMP
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index 6a6409a..a20b8f6 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -353,6 +353,9 @@ config MN10300_TTYSM2_CTS
 
 endmenu
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 source "mm/Kconfig"
 
 menu "Power management options"
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index bc7a19d..9ec4fcd 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -240,6 +240,9 @@ config NODES_SHIFT
 	default "3"
 	depends on NEED_MULTIPLE_NODES
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 source "kernel/Kconfig.preempt"
 source "kernel/Kconfig.hz"
 source "mm/Kconfig"
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 1189d8d..8950e0c 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -350,6 +350,9 @@ config ARCH_SPARSEMEM_DEFAULT
 config ARCH_POPULATES_NODE_MAP
 	def_bool y
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 source "mm/Kconfig"
 
 config ARCH_MEMORY_PROBE
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index abc877f..db5e6a1 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -924,6 +924,9 @@ config HIGHMEM
 config ARCH_POPULATES_NODE_MAP
 	def_bool y
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 source kernel/Kconfig.hz
 source kernel/Kconfig.preempt
 source "mm/Kconfig"
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 1831833..6fb2b79 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -282,6 +282,9 @@ config WARN_STACK_SIZE
 config ARCH_POPULATES_NODE_MAP
 	def_bool y
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 comment "Kernel preemption"
 
 source "kernel/Kconfig.preempt"
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index 5fd2184..b74c4e7 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -138,6 +138,9 @@ config ARCH_MEMORY_PROBE
 	def_bool y
 	depends on MEMORY_HOTPLUG
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 choice
 	prompt "Kernel page size"
 	default PAGE_SIZE_8KB if X2TLB
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index c40343c..8fc06c3 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -266,6 +266,9 @@ config SUNOS_EMUL
 	  want to run SunOS binaries on an Ultra you must also say Y to
 	  "Kernel support for 32-bit a.out binaries" above.
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 source "mm/Kconfig"
 
 endmenu
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 463d1be..d74b027 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -267,6 +267,9 @@ config ARCH_SPARSEMEM_ENABLE
 config ARCH_SPARSEMEM_DEFAULT
 	def_bool y
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 source "mm/Kconfig"
 
 config ISA
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index dba8e05..f3b75af 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -86,6 +86,10 @@ config STATIC_LINK
 	  2.75G) for UML.
 
 source "arch/um/Kconfig.arch"
+
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 source "mm/Kconfig"
 source "kernel/time/Kconfig"
 
diff --git a/arch/v850/Kconfig b/arch/v850/Kconfig
index 4379f43..a4d8e72 100644
--- a/arch/v850/Kconfig
+++ b/arch/v850/Kconfig
@@ -56,6 +56,9 @@ config ARCH_HAS_ILOG2_U64
 config ARCH_SUPPORTS_AOUT
 	def_bool y
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 # Turn off some random 386 crap that can affect device config
 config ISA
 	bool
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 6c70fed..47bb585 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -939,6 +939,9 @@ config ARCH_MEMORY_PROBE
 	def_bool X86_64
 	depends on MEMORY_HOTPLUG
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 source "mm/Kconfig"
 
 config HIGHPTE
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 9fc8551..0e3b68c 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -163,6 +163,9 @@ config XTENSA_ISS_NETWORK
 	depends on XTENSA_PLATFORM_ISS
 	default y
 
+config HAVE_ARCH_SHOW_MEM
+	def_bool y
+
 source "mm/Kconfig"
 
 endmenu
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 402a504..0eef95f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -45,6 +45,7 @@
 #include <linux/fault-inject.h>
 #include <linux/page-isolation.h>
 #include <linux/memcontrol.h>
+#include <linux/nmi.h>
 
 #include <asm/tlbflush.h>
 #include <asm/div64.h>
@@ -1889,6 +1890,58 @@ void show_free_areas(void)
 	show_swap_cache_info();
 }
 
+#ifndef CONFIG_HAVE_ARCH_SHOW_MEM
+void show_mem(void)
+{
+	pg_data_t *pgdat;
+	int total = 0, reserved = 0, shared = 0, highmem = 0, swapcache = 0;
+
+	printk(KERN_INFO "Mem-Info:\n");
+	show_free_areas();
+
+	for_each_online_pgdat(pgdat) {
+		unsigned long i, flags;
+
+		pgdat_resize_lock(pgdat, &flags);
+		for (i = 0; i < pgdat->node_spanned_pages; i++) {
+			struct page *page;
+			unsigned long pfn = pgdat->node_start_pfn + i;
+
+			if (unlikely((i % MAX_ORDER_NR_PAGES) == 0))
+				touch_nmi_watchdog();
+
+			if (!pfn_valid(pfn))
+				continue;
+
+			page = pfn_to_page(pfn);
+
+			if (PageHighMem(page))
+				highmem++;
+
+			if (PageReserved(page))
+				reserved++;
+			else if (PageSwapCache(page))
+				swapcache++;
+			else if (page_count(page) > 1)
+				shared += page_count(page) - 1;
+
+			total++;
+		}
+		pgdat_resize_unlock(pgdat, &flags);
+	}
+
+	printk(KERN_INFO "%d pages RAM\n", total);
+#ifdef CONFIG_HIGHMEM
+	printk(KERN_INFO "%d pages HighMem\n", highmem);
+#endif
+	printk(KERN_INFO "%d pages reserved\n", reserved);
+	printk(KERN_INFO "%d pages shared\n", shared);
+#ifdef CONFIG_SWAP
+	printk(KERN_INFO "%d pages swapcache\n", swapcache);
+#endif
+}
+#endif /* !CONFIG_HAVE_ARCH_SHOW_MEM */
+
 /*
  * Builds allocation fallback zone lists.
  *
-- 
1.5.2.2

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

* [RFC 02/22] x86: Use generic show_mem()
  2008-04-02 20:29 [RFC 00/21] Generic show_mem() Johannes Weiner
  2008-04-02 20:29 ` [RFC 01/22] Generic show_mem() implementation Johannes Weiner
@ 2008-04-02 20:29 ` Johannes Weiner
  2008-04-02 20:29 ` [RFC 03/22] sparc64: " Johannes Weiner
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Johannes Weiner @ 2008-04-02 20:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, mingo, davem, hskinnemoen, cooloney, starvik, dhowells,
	ysato, takata, geert, ralf, kyle, paulus, schwidefsky, lethal,
	jdike, miles, chris, rmk, tony.luck


Signed-off-by: Johannes Weiner <hannes@saeurebad.de>

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 47bb585..6c70fed 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -939,9 +939,6 @@ config ARCH_MEMORY_PROBE
 	def_bool X86_64
 	depends on MEMORY_HOTPLUG
 
-config HAVE_ARCH_SHOW_MEM
-	def_bool y
-
 source "mm/Kconfig"
 
 config HIGHPTE
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index a02a14f..82f3b6d 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -60,46 +60,6 @@ DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
  * around without checking the pgd every time.
  */
 
-void show_mem(void)
-{
-	long i, total = 0, reserved = 0;
-	long shared = 0, cached = 0;
-	struct page *page;
-	pg_data_t *pgdat;
-
-	printk(KERN_INFO "Mem-info:\n");
-	show_free_areas();
-	printk(KERN_INFO "Free swap:       %6ldkB\n",
-		nr_swap_pages << (PAGE_SHIFT-10));
-
-	for_each_online_pgdat(pgdat) {
-		for (i = 0; i < pgdat->node_spanned_pages; ++i) {
-			/*
-			 * This loop can take a while with 256 GB and
-			 * 4k pages so defer the NMI watchdog:
-			 */
-			if (unlikely(i % MAX_ORDER_NR_PAGES == 0))
-				touch_nmi_watchdog();
-
-			if (!pfn_valid(pgdat->node_start_pfn + i))
-				continue;
-
-			page = pfn_to_page(pgdat->node_start_pfn + i);
-			total++;
-			if (PageReserved(page))
-				reserved++;
-			else if (PageSwapCache(page))
-				cached++;
-			else if (page_count(page))
-				shared += page_count(page) - 1;
-		}
-	}
-	printk(KERN_INFO "%lu pages of RAM\n",		total);
-	printk(KERN_INFO "%lu reserved pages\n",	reserved);
-	printk(KERN_INFO "%lu pages shared\n",		shared);
-	printk(KERN_INFO "%lu pages swap cached\n",	cached);
-}
-
 int after_bootmem;
 
 static __init void *spp_getpage(void)
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c
index 2f9e9af..ead7015 100644
--- a/arch/x86/mm/pgtable_32.c
+++ b/arch/x86/mm/pgtable_32.c
@@ -24,54 +24,6 @@
 #include <asm/tlb.h>
 #include <asm/tlbflush.h>
 
-void show_mem(void)
-{
-	int total = 0, reserved = 0;
-	int shared = 0, cached = 0;
-	int highmem = 0;
-	struct page *page;
-	pg_data_t *pgdat;
-	unsigned long i;
-	unsigned long flags;
-
-	printk(KERN_INFO "Mem-info:\n");
-	show_free_areas();
-	printk(KERN_INFO "Free swap:       %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
-	for_each_online_pgdat(pgdat) {
-		pgdat_resize_lock(pgdat, &flags);
-		for (i = 0; i < pgdat->node_spanned_pages; ++i) {
-			if (unlikely(i % MAX_ORDER_NR_PAGES == 0))
-				touch_nmi_watchdog();
-			page = pgdat_page_nr(pgdat, i);
-			total++;
-			if (PageHighMem(page))
-				highmem++;
-			if (PageReserved(page))
-				reserved++;
-			else if (PageSwapCache(page))
-				cached++;
-			else if (page_count(page))
-				shared += page_count(page) - 1;
-		}
-		pgdat_resize_unlock(pgdat, &flags);
-	}
-	printk(KERN_INFO "%d pages of RAM\n", total);
-	printk(KERN_INFO "%d pages of HIGHMEM\n", highmem);
-	printk(KERN_INFO "%d reserved pages\n", reserved);
-	printk(KERN_INFO "%d pages shared\n", shared);
-	printk(KERN_INFO "%d pages swap cached\n", cached);
-
-	printk(KERN_INFO "%lu pages dirty\n", global_page_state(NR_FILE_DIRTY));
-	printk(KERN_INFO "%lu pages writeback\n",
-					global_page_state(NR_WRITEBACK));
-	printk(KERN_INFO "%lu pages mapped\n", global_page_state(NR_FILE_MAPPED));
-	printk(KERN_INFO "%lu pages slab\n",
-		global_page_state(NR_SLAB_RECLAIMABLE) +
-		global_page_state(NR_SLAB_UNRECLAIMABLE));
-	printk(KERN_INFO "%lu pages pagetables\n",
-					global_page_state(NR_PAGETABLE));
-}
-
 /*
  * Associate a virtual page frame with a given physical page frame 
  * and protection flags for that frame.
-- 
1.5.2.2

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

* [RFC 03/22] sparc64: Use generic show_mem()
  2008-04-02 20:29 [RFC 00/21] Generic show_mem() Johannes Weiner
  2008-04-02 20:29 ` [RFC 01/22] Generic show_mem() implementation Johannes Weiner
  2008-04-02 20:29 ` [RFC 02/22] x86: Use generic show_mem() Johannes Weiner
@ 2008-04-02 20:29 ` Johannes Weiner
  2008-04-02 20:29 ` [RFC 04/22] avr32: " Johannes Weiner
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Johannes Weiner @ 2008-04-02 20:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, mingo, davem, hskinnemoen, cooloney, starvik, dhowells,
	ysato, takata, geert, ralf, kyle, paulus, schwidefsky, lethal,
	jdike, miles, chris, rmk, tony.luck


Signed-off-by: Johannes Weiner <hannes@saeurebad.de>

diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index d74b027..463d1be 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -267,9 +267,6 @@ config ARCH_SPARSEMEM_ENABLE
 config ARCH_SPARSEMEM_DEFAULT
 	def_bool y
 
-config HAVE_ARCH_SHOW_MEM
-	def_bool y
-
 source "mm/Kconfig"
 
 config ISA
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index f37078d..f6a86a2 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -391,51 +391,6 @@ void __kprobes flush_icache_range(unsigned long start, unsigned long end)
 	}
 }
 
-void show_mem(void)
-{
-	unsigned long total = 0, reserved = 0;
-	unsigned long shared = 0, cached = 0;
-	pg_data_t *pgdat;
-
-	printk(KERN_INFO "Mem-info:\n");
-	show_free_areas();
-	printk(KERN_INFO "Free swap:       %6ldkB\n",
-	       nr_swap_pages << (PAGE_SHIFT-10));
-	for_each_online_pgdat(pgdat) {
-		unsigned long i, flags;
-
-		pgdat_resize_lock(pgdat, &flags);
-		for (i = 0; i < pgdat->node_spanned_pages; i++) {
-			struct page *page = pgdat_page_nr(pgdat, i);
-			total++;
-			if (PageReserved(page))
-				reserved++;
-			else if (PageSwapCache(page))
-				cached++;
-			else if (page_count(page))
-				shared += page_count(page) - 1;
-		}
-		pgdat_resize_unlock(pgdat, &flags);
-	}
-
-	printk(KERN_INFO "%lu pages of RAM\n", total);
-	printk(KERN_INFO "%lu reserved pages\n", reserved);
-	printk(KERN_INFO "%lu pages shared\n", shared);
-	printk(KERN_INFO "%lu pages swap cached\n", cached);
-
-	printk(KERN_INFO "%lu pages dirty\n",
-	       global_page_state(NR_FILE_DIRTY));
-	printk(KERN_INFO "%lu pages writeback\n",
-	       global_page_state(NR_WRITEBACK));
-	printk(KERN_INFO "%lu pages mapped\n",
-	       global_page_state(NR_FILE_MAPPED));
-	printk(KERN_INFO "%lu pages slab\n",
-		global_page_state(NR_SLAB_RECLAIMABLE) +
-		global_page_state(NR_SLAB_UNRECLAIMABLE));
-	printk(KERN_INFO "%lu pages pagetables\n",
-	       global_page_state(NR_PAGETABLE));
-}
-
 void mmu_info(struct seq_file *m)
 {
 	if (tlb_type == cheetah)
-- 
1.5.2.2

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

* [RFC 04/22] avr32: Use generic show_mem()
  2008-04-02 20:29 [RFC 00/21] Generic show_mem() Johannes Weiner
                   ` (2 preceding siblings ...)
  2008-04-02 20:29 ` [RFC 03/22] sparc64: " Johannes Weiner
@ 2008-04-02 20:29 ` Johannes Weiner
  2008-04-02 21:53 ` [RFC 00/21] Generic show_mem() Luck, Tony
  2008-04-02 22:02 ` Johannes Weiner
  5 siblings, 0 replies; 8+ messages in thread
From: Johannes Weiner @ 2008-04-02 20:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, mingo, davem, hskinnemoen, cooloney, starvik, dhowells,
	ysato, takata, geert, ralf, kyle, paulus, schwidefsky, lethal,
	jdike, miles, chris, rmk, tony.luck


Signed-off-by: Johannes Weiner <hannes@saeurebad.de>

diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index 81e3360..c75d708 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -146,9 +146,6 @@ source "kernel/Kconfig.preempt"
 config HAVE_ARCH_BOOTMEM_NODE
 	def_bool n
 
-config HAVE_ARCH_SHOW_MEM
-	def_bool y
-
 config ARCH_HAVE_MEMORY_PRESENT
 	def_bool n
 
diff --git a/arch/avr32/mm/init.c b/arch/avr32/mm/init.c
index 480760b..3cbff55 100644
--- a/arch/avr32/mm/init.c
+++ b/arch/avr32/mm/init.c
@@ -37,45 +37,6 @@ unsigned long mmu_context_cache = NO_CONTEXT;
 #define START_PFN	(NODE_DATA(0)->bdata->node_boot_start >> PAGE_SHIFT)
 #define MAX_LOW_PFN	(NODE_DATA(0)->bdata->node_low_pfn)
 
-void show_mem(void)
-{
-	int total = 0, reserved = 0, cached = 0;
-	int slab = 0, free = 0, shared = 0;
-	pg_data_t *pgdat;
-
-	printk("Mem-info:\n");
-	show_free_areas();
-
-	for_each_online_pgdat(pgdat) {
-		struct page *page, *end;
-
-		page = pgdat->node_mem_map;
-		end = page + pgdat->node_spanned_pages;
-
-		do {
-			total++;
-			if (PageReserved(page))
-				reserved++;
-			else if (PageSwapCache(page))
-				cached++;
-			else if (PageSlab(page))
-				slab++;
-			else if (!page_count(page))
-				free++;
-			else
-				shared += page_count(page) - 1;
-			page++;
-		} while (page < end);
-	}
-
-	printk ("%d pages of RAM\n", total);
-	printk ("%d free pages\n", free);
-	printk ("%d reserved pages\n", reserved);
-	printk ("%d slab pages\n", slab);
-	printk ("%d pages shared\n", shared);
-	printk ("%d pages swap cached\n", cached);
-}
-
 /*
  * paging_init() sets up the page tables
  *
-- 
1.5.2.2

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

* RE: [RFC 00/21] Generic show_mem()
  2008-04-02 20:29 [RFC 00/21] Generic show_mem() Johannes Weiner
                   ` (3 preceding siblings ...)
  2008-04-02 20:29 ` [RFC 04/22] avr32: " Johannes Weiner
@ 2008-04-02 21:53 ` Luck, Tony
  2008-04-02 22:02 ` Johannes Weiner
  5 siblings, 0 replies; 8+ messages in thread
From: Luck, Tony @ 2008-04-02 21:53 UTC (permalink / raw)
  To: Johannes Weiner, linux-kernel
  Cc: linux-mm, mingo, davem, hskinnemoen, cooloney, starvik, dhowells,
	ysato, takata, geert, ralf, kyle, paulus, schwidefsky, lethal,
	jdike, miles, chris, rmk

> Tony, as far as I understand, ia64 jumps holes in the memory map with
> vmemmap_find_next_valid_pfn().  Any idea if and how this could be
> built into the generic show_mem() version?

Perhaps it might be worth looking at this when ia64 slims down to
just one memory model (using sparse virtual mem map).  But I don't
think anyone is actively working on this.  Right now we have two
very different show_mem() functions for the contig and discontig
cases.

This whole function sends shivers down my spine for a large
system though ... that inner loop looks at every single page
structure ... on a multi-terabyte machine that could run to
billions of cache misses.  Hope the users aren't in a hurry
to see the answer ... or doing something painful like:

	# watch -n 1 cat /proc/meminfo

-Tony

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

* Re: [RFC 00/21] Generic show_mem()
  2008-04-02 20:29 [RFC 00/21] Generic show_mem() Johannes Weiner
                   ` (4 preceding siblings ...)
  2008-04-02 21:53 ` [RFC 00/21] Generic show_mem() Luck, Tony
@ 2008-04-02 22:02 ` Johannes Weiner
  5 siblings, 0 replies; 8+ messages in thread
From: Johannes Weiner @ 2008-04-02 22:02 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, mingo, davem, hskinnemoen, cooloney, starvik, dhowells,
	ysato, takata, geert, ralf, kyle, paulus, schwidefsky, lethal,
	jdike, miles, chris, rmk, tony.luck

Hi,

sorry, my mailserver went bollocks.  Please ignore the second
submission.

	Hannes

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

* [RFC 04/22] avr32: Use generic show_mem()
  2008-04-02 20:40 Johannes Weiner
@ 2008-04-02 20:40 ` Johannes Weiner
  0 siblings, 0 replies; 8+ messages in thread
From: Johannes Weiner @ 2008-04-02 20:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, mingo, davem, hskinnemoen, cooloney, starvik, dhowells,
	ysato, takata, geert, ralf, kyle, paulus, schwidefsky, lethal,
	jdike, miles, chris, rmk, tony.luck


Signed-off-by: Johannes Weiner <hannes@saeurebad.de>

diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index 81e3360..c75d708 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -146,9 +146,6 @@ source "kernel/Kconfig.preempt"
 config HAVE_ARCH_BOOTMEM_NODE
 	def_bool n
 
-config HAVE_ARCH_SHOW_MEM
-	def_bool y
-
 config ARCH_HAVE_MEMORY_PRESENT
 	def_bool n
 
diff --git a/arch/avr32/mm/init.c b/arch/avr32/mm/init.c
index 480760b..3cbff55 100644
--- a/arch/avr32/mm/init.c
+++ b/arch/avr32/mm/init.c
@@ -37,45 +37,6 @@ unsigned long mmu_context_cache = NO_CONTEXT;
 #define START_PFN	(NODE_DATA(0)->bdata->node_boot_start >> PAGE_SHIFT)
 #define MAX_LOW_PFN	(NODE_DATA(0)->bdata->node_low_pfn)
 
-void show_mem(void)
-{
-	int total = 0, reserved = 0, cached = 0;
-	int slab = 0, free = 0, shared = 0;
-	pg_data_t *pgdat;
-
-	printk("Mem-info:\n");
-	show_free_areas();
-
-	for_each_online_pgdat(pgdat) {
-		struct page *page, *end;
-
-		page = pgdat->node_mem_map;
-		end = page + pgdat->node_spanned_pages;
-
-		do {
-			total++;
-			if (PageReserved(page))
-				reserved++;
-			else if (PageSwapCache(page))
-				cached++;
-			else if (PageSlab(page))
-				slab++;
-			else if (!page_count(page))
-				free++;
-			else
-				shared += page_count(page) - 1;
-			page++;
-		} while (page < end);
-	}
-
-	printk ("%d pages of RAM\n", total);
-	printk ("%d free pages\n", free);
-	printk ("%d reserved pages\n", reserved);
-	printk ("%d slab pages\n", slab);
-	printk ("%d pages shared\n", shared);
-	printk ("%d pages swap cached\n", cached);
-}
-
 /*
  * paging_init() sets up the page tables
  *
-- 
1.5.2.2

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

end of thread, other threads:[~2008-04-02 22:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-02 20:29 [RFC 00/21] Generic show_mem() Johannes Weiner
2008-04-02 20:29 ` [RFC 01/22] Generic show_mem() implementation Johannes Weiner
2008-04-02 20:29 ` [RFC 02/22] x86: Use generic show_mem() Johannes Weiner
2008-04-02 20:29 ` [RFC 03/22] sparc64: " Johannes Weiner
2008-04-02 20:29 ` [RFC 04/22] avr32: " Johannes Weiner
2008-04-02 21:53 ` [RFC 00/21] Generic show_mem() Luck, Tony
2008-04-02 22:02 ` Johannes Weiner
2008-04-02 20:40 Johannes Weiner
2008-04-02 20:40 ` [RFC 04/22] avr32: Use generic show_mem() Johannes Weiner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox