[Linux-ia64] show_mem for discontig

From: Jesse Barnes <jbarnes_at_sgi.com>
Date: 2001-10-05 08:06:04
Here's a small patch I came up with to implement the show_mem() function
for CONFIG_DISCONTIG.  This could could actually be used in the
non-discontig case as well, but we'll probably be adding more per-node
statistics to it, so it might be best to keep it seperate.  I'm submitting
it for inclusing into the ia64 patch.  Feedback would be appreciated.

Thanks,
Jesse

--- /usr/tmp/TmpDir.9409-0/linux/arch/ia64/mm/init.c_1.13	Thu Oct  4 15:03:48 2001
+++ linux/arch/ia64/mm/init.c	Thu Oct  4 12:52:08 2001
@@ -208,9 +208,30 @@
 void
 show_mem(void)
 {
-	printk("show_mem: fixme\n") ;
+	int i, total = 0, reserved = 0;
+	int shared = 0, cached = 0;
+	pg_data_t *pgdat = pgdat_list;
+
 	printk("Mem-info:\n");
 	show_free_areas();
+	printk("Free swap:       %6dkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
+	do {
+		printk("Node ID: %d\n", pgdat->node_id);
+		for(i = 0; i < pgdat->node_size; i++) {
+			if (PageReserved(pgdat->node_mem_map+i))
+				reserved++;
+			else if (PageSwapCache(pgdat->node_mem_map+i))
+				cached++;
+			else if (page_count(pgdat->node_mem_map + i))
+				shared += page_count(pgdat->node_mem_map + i) - 1;
+		}
+		printk("\t%d pages of RAM\n", pgdat->node_size);
+		printk("\t%d reserved pages\n", reserved);
+		printk("\t%d pages shared\n", shared);
+		printk("\t%d pages swap cached\n", cached);
+		pgdat = pgdat->node_next;
+	} while(pgdat);
+	printk("Total of %ld pages in page table cache\n", pgtable_cache_size);
 	show_buffers();
 	printk("%d free buffer pages\n", nr_free_buffer_pages());
 }
Received on Thu Oct 04 15:07:32 2001

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:05 EST