From e177ea28e7eded3490174487c81e5bef8a2c4d95 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Thu, 18 Jul 2002 21:09:17 -0700 Subject: [PATCH] VM instrumentation A patch from Rik which adds some operational statitics to the VM. In /proc/meminfo: PageTables: Amount of memory used for process pagetables PteChainTot: Amount of memory allocated for pte_chain objects PteChainUsed: Amount of memory currently in use for pte chains. In /proc/stat: pageallocs: Number of pages allocated in the page allocator pagefrees: Number of pages returned to the page allocator (These can be used to measure the allocation rate) pageactiv: Number of pages activated (moved to the active list) pagedeact: Number of pages deactivated (moved to the inactive list) pagefault: Total pagefaults majorfault: Major pagefaults pagescan: Number of pages which shrink_cache looked at pagesteal: Number of pages which shrink_cache freed pageoutrun: Number of calls to try_to_free_pages() allocstall: Number of calls to balance_classzone() Rik will be writing a userspace app which interprets these things. The /proc/meminfo stats are efficient, but the /proc/stat accumulators will cause undesirable cacheline bouncing. We need to break the disk statistics out of struct kernel_stat and make everything else in there per-cpu. If that doesn't happen in time for 2.6 then we disable KERNEL_STAT_INC(). --- fs/proc/proc_misc.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'fs') diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 686bf540ed9c..a84b41f61ba9 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c @@ -159,7 +159,10 @@ static int meminfo_read_proc(char *page, char **start, off_t off, "SwapTotal: %8lu kB\n" "SwapFree: %8lu kB\n" "Dirty: %8lu kB\n" - "Writeback: %8lu kB\n", + "Writeback: %8lu kB\n" + "PageTables: %8lu kB\n" + "PteChainTot: %8lu kB\n" + "PteChainUsed: %8lu kB\n", K(i.totalram), K(i.freeram), K(i.sharedram), @@ -174,7 +177,10 @@ static int meminfo_read_proc(char *page, char **start, off_t off, K(i.totalswap), K(i.freeswap), K(ps.nr_dirty), - K(ps.nr_writeback) + K(ps.nr_writeback), + K(ps.nr_page_table_pages), + K(ps.nr_pte_chain_pages), + ps.used_pte_chains_bytes >> 10 ); return proc_calc_metrics(page, start, off, count, eof, len); @@ -347,9 +353,29 @@ static int kstat_read_proc(char *page, char **start, off_t off, } len += sprintf(page + len, - "\nctxt %lu\n" + "\npageallocs %u\n" + "pagefrees %u\n" + "pageactiv %u\n" + "pagedeact %u\n" + "pagefault %u\n" + "majorfault %u\n" + "pagescan %u\n" + "pagesteal %u\n" + "pageoutrun %u\n" + "allocstall %u\n" + "ctxt %lu\n" "btime %lu\n" "processes %lu\n", + kstat.pgalloc, + kstat.pgfree, + kstat.pgactivate, + kstat.pgdeactivate, + kstat.pgfault, + kstat.pgmajfault, + kstat.pgscan, + kstat.pgsteal, + kstat.pageoutrun, + kstat.allocstall, nr_context_switches(), xtime.tv_sec - jif / HZ, total_forks); -- cgit v1.2.3