linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <clameter@sgi.com>
To: linux-kernel@vger.kernel.org
Cc: Nick Piggin <nickpiggin@yahoo.com.au>,
	linux-mm@kvack.org,
	Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
	Andi Kleen <ak@suse.de>, Christoph Lameter <clameter@sgi.com>
Subject: Zoned counters V1 [ 3/14]: Include zoned counters in /proc/vmstat
Date: Tue, 20 Dec 2005 14:02:06 -0800 (PST)	[thread overview]
Message-ID: <20051220220206.30326.8483.sendpatchset@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20051220220151.30326.98563.sendpatchset@schroedinger.engr.sgi.com>

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)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2005-12-20 22:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-20 22:01 Zoned counters V1 [ 0/14]: Overview Christoph Lameter
2005-12-20 22:01 ` Zoned counters V1 [ 1/14]: Add some consts for inlines in mm.h Christoph Lameter
2005-12-20 22:02 ` Zoned counters V1 [ 2/14]: Basic counter functionality Christoph Lameter
2005-12-20 22:02 ` Christoph Lameter [this message]
2005-12-20 22:02 ` Zoned counters V1 [ 4/14]: Convert nr_mapped Christoph Lameter
2005-12-20 22:02 ` Zoned counters V1 [ 5/14]: Convert nr_pagecache Christoph Lameter
2005-12-20 22:02 ` Zoned counters V1 [ 6/14]: Expanded node and zone statistics Christoph Lameter
2005-12-20 22:02 ` Zoned counters V1 [ 7/14]: Convert nr_slab Christoph Lameter
2005-12-20 22:02 ` Zoned counters V1 [ 8/14]: Convert nr_page_table Christoph Lameter
2005-12-20 22:02 ` Zoned counters V1 [ 9/14]: Convert nr_dirty Christoph Lameter
2005-12-20 22:02 ` Zoned counters V1 [10/14]: Convert nr_writeback Christoph Lameter
2005-12-20 22:02 ` Zoned counters V1 [11/14]: Convert nr_unstable Christoph Lameter
2005-12-20 22:02 ` Zoned counters V1 [12/14]: Convert nr_bounce Christoph Lameter
2005-12-20 22:02 ` Zoned counters V1 [13/14]: Remove get_page_state functions Christoph Lameter
2005-12-20 22:03 ` Zoned counters V1 [14/14]: Remove wbs Christoph Lameter
2005-12-23 11:57   ` Coywolf Qi Hunt
2005-12-23 17:27     ` Christoph Lameter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051220220206.30326.8483.sendpatchset@schroedinger.engr.sgi.com \
    --to=clameter@sgi.com \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=nickpiggin@yahoo.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox