lkml.org 
[lkml]   [2006]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 02/14] Include per zone counters in /proc/vmstat
Add zoned counters to /proc/vmstat

This makes vmstat print counters from a combined array of zoned counters
plus the current page_state (which will be later be replaced by the
event counter patchset).

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.17-rc6-mm1/mm/page_alloc.c
===================================================================
--- linux-2.6.17-rc6-mm1.orig/mm/page_alloc.c 2006-06-08 13:51:16.145258328 -0700
+++ linux-2.6.17-rc6-mm1/mm/page_alloc.c 2006-06-08 13:53:18.336915650 -0700
@@ -2800,6 +2800,9 @@ struct seq_operations zoneinfo_op = {
};

static char *vmstat_text[] = {
+ /* Zoned VM counters */
+
+ /* Page state */
"nr_dirty",
"nr_writeback",
"nr_unstable",
@@ -2857,19 +2860,25 @@ static char *vmstat_text[] = {

static void *vmstat_start(struct seq_file *m, loff_t *pos)
{
+ unsigned long *v;
struct page_state *ps;
+ int i;

if (*pos >= ARRAY_SIZE(vmstat_text))
return NULL;

- ps = kmalloc(sizeof(*ps), GFP_KERNEL);
- m->private = ps;
- if (!ps)
+ v = kmalloc(NR_STAT_ITEMS * sizeof(unsigned long)
+ + sizeof(struct page_state), GFP_KERNEL);
+ m->private = v;
+ if (!v)
return ERR_PTR(-ENOMEM);
+ for (i = 0; i < NR_STAT_ITEMS; i++)
+ v[i] = global_page_state(i);
+ ps = (struct page_state *)(v + NR_STAT_ITEMS);
get_full_page_state(ps);
ps->pgpgin /= 2; /* sectors -> kbytes */
ps->pgpgout /= 2;
- return (unsigned long *)ps + *pos;
+ return v + *pos;
}

static void *vmstat_next(struct seq_file *m, void *arg, loff_t *pos)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-06-09 01:05    [W:0.097 / U:0.908 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site