Skip to contentSkip to conversation

add page_state info to show_mem

PATCH In review Martin J. Bligh 2 participants 2 messages Jun 1, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add page_state info to show_mem

This helps a lot when debugging out of memory stuff - useful especially to see if all the memory is sucked into slab, etc.

arch/i386/mm/pgtable.c +8 -0
diff -purN -X /home/mbligh/.diff.exclude 2.6.11/arch/i386/mm/pgtable.c 2.6.11-show_mem_slab/arch/i386/mm/pgtable.c
@@ -30,6 +30,7 @@ void show_mem(void)
 	struct page *page;
 	pg_data_t *pgdat;
 	unsigned long i;
+	struct page_state ps;
 
 	printk("Mem-info:\n");
 	show_free_areas();
@@ -53,6 +54,13 @@ void show_mem(void)
 	printk("%d reserved pages\n",reserved);
 	printk("%d pages shared\n",shared);
 	printk("%d pages swap cached\n",cached);
+
+	get_page_state(&ps);
+	printk("%d pages dirty\n", ps.nr_dirty);
+	printk("%d pages writeback\n", ps.nr_writeback);
+	printk("%d pages mapped\n", ps.nr_mapped);
+	printk("%d pages slab\n", ps.nr_slab);
+	printk("%d pages pagetables\n", ps.nr_page_table_pages);
 }
 
 /*
#1 lore raw

Hi,

Quoted 2 lines

This helps a lot when debugging out of memory stuff - useful especially to see if all the memory is sucked into slab, etc.

I was going to add this to ppc64 but I noticed that except for HIGHMEM bits it all looks the same :) Perhaps show_mem should end up somewhere common.

Anton

Quoted 31 lines

diff -purN -X /home/mbligh/.diff.exclude 2.6.11/arch/i386/mm/pgtable.c 2.6.11-show_mem_slab/arch/i386/mm/pgtable.c

arch/i386/mm/pgtable.c +8 -1
@@ -30,6 +30,7 @@ void show_mem(void)
 	struct page *page;
 	pg_data_t *pgdat;
 	unsigned long i;
+	struct page_state ps;
 
 	printk("Mem-info:\n");
 	show_free_areas();
@@ -53,6 +54,13 @@ void show_mem(void)
 	printk("%d reserved pages\n",reserved);
 	printk("%d pages shared\n",shared);
 	printk("%d pages swap cached\n",cached);
+
+	get_page_state(&ps);
+	printk("%d pages dirty\n", ps.nr_dirty);
+	printk("%d pages writeback\n", ps.nr_writeback);
+	printk("%d pages mapped\n", ps.nr_mapped);
+	printk("%d pages slab\n", ps.nr_slab);
+	printk("%d pages pagetables\n", ps.nr_page_table_pages);
 }
 
 /*
 
-

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