Zoned counters V1 [ 3/14]: Include zoned counters in /proc/vmstat

Christoph Lameter
2005-12-20T22:02:06Z

Make /proc/vmstat include zoned couters

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

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

Index: linux-2.6.15-rc5-mm3/mm/page_alloc.c
===================================================================
--- linux-2.6.15-rc5-mm3.orig/mm/page_alloc.c 2005-12-20 12:05:56.000000000 -0800
+++ linux-2.6.15-rc5-mm3/mm/page_alloc.c 2005-12-20 12:19:01.000000000 -0800
@@ -2673,6 +2673,9 @@ struct seq_operations zoneinfo_op = {
};

static char *vmstat_text[] = {
+ /* Zoned VM counters */
+
+ /* Page state */
"nr_dirty",
"nr_writeback",
"nr_unstable",
@@ -2730,19 +2733,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)