All of lore.kernel.org
 help / color / mirror / Atom feed
* [Linux-ia64] show_mem for discontig
@ 2001-10-04 22:06 Jesse Barnes
  0 siblings, 0 replies; only message in thread
From: Jesse Barnes @ 2001-10-04 22:06 UTC (permalink / raw)
  To: linux-ia64

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());
 }



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-10-04 22:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-04 22:06 [Linux-ia64] show_mem for discontig Jesse Barnes

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.