From: Nikita Danilov <Nikita@Namesys.COM>
To: Linux Kernel Mailing List <Linux-Kernel@Vger.Kernel.ORG>
Subject: [PATCH] 4/5 VM changes: zoneinfo.patch
Date: Wed, 9 Jul 2003 12:47:29 +0400 [thread overview]
Message-ID: <16139.54945.45955.840028@laputa.namesys.com> (raw)
Add /proc/zoneinfo file to display information about memory zones.
diff -puN fs/proc/proc_misc.c~zoneinfo fs/proc/proc_misc.c
--- i386/fs/proc/proc_misc.c~zoneinfo Wed Jul 9 12:24:52 2003
+++ i386-god/fs/proc/proc_misc.c Wed Jul 9 12:24:52 2003
@@ -251,6 +251,20 @@ static struct file_operations fragmentat
.release = seq_release,
};
+extern struct seq_operations zoneinfo_op;
+static int zoneinfo_open(struct inode *inode, struct file *file)
+{
+ (void)inode;
+ return seq_open(file, &zoneinfo_op);
+}
+
+static struct file_operations proc_zoneinfo_file_operations = {
+ .open = zoneinfo_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+
static int version_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
@@ -694,6 +708,7 @@ void __init proc_misc_init(void)
create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations);
create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations);
create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations);
+ create_seq_entry("zoneinfo",S_IRUGO, &proc_zoneinfo_file_operations);
create_seq_entry("diskstats", 0, &proc_diskstats_operations);
#ifdef CONFIG_MODULES
create_seq_entry("modules", 0, &proc_modules_operations);
diff -puN mm/page_alloc.c~zoneinfo mm/page_alloc.c
--- i386/mm/page_alloc.c~zoneinfo Wed Jul 9 12:24:52 2003
+++ i386-god/mm/page_alloc.c Wed Jul 9 12:24:52 2003
@@ -1464,6 +1464,61 @@ struct seq_operations fragmentation_op =
.show = frag_show,
};
+/*
+ * Output information about zones in @pgdat.
+ */
+static int zoneinfo_show(struct seq_file *m, void *arg)
+{
+ pg_data_t *pgdat = (pg_data_t *)arg;
+ struct zone *zone;
+ struct zone *node_zones = pgdat->node_zones;
+ unsigned long flags;
+
+ for (zone = node_zones; zone - node_zones < MAX_NR_ZONES; ++zone) {
+ if (!zone->present_pages)
+ continue;
+
+ spin_lock_irqsave(&zone->lock, flags);
+ seq_printf(m, "Node %d, zone %8s", pgdat->node_id, zone->name);
+ seq_printf(m,
+ "\n\tpages free %lu"
+ "\n\tpages min %lu"
+ "\n\tpages low %lu"
+ "\n\tpages high %lu"
+ "\n\tpages active %lu"
+ "\n\tpages inactive %lu"
+ "\n\tpages scanned %lu"
+ "\n\tpages spanned %lu"
+ "\n\tpages present %lu",
+ zone->free_pages,
+ zone->pages_min,
+ zone->pages_low,
+ zone->pages_high,
+ zone->nr_active,
+ zone->nr_inactive,
+ zone->pages_scanned,
+ zone->spanned_pages,
+ zone->present_pages);
+ seq_printf(m,
+ "\n\trefill %i"
+ "\n\tall_unreclaimable: %u"
+ "\n\tpressure: %i",
+ atomic_read(&zone->refill_counter),
+ zone->all_unreclaimable, zone->pressure);
+ spin_unlock_irqrestore(&zone->lock, flags);
+ seq_putc(m, '\n');
+ }
+ return 0;
+}
+
+struct seq_operations zoneinfo_op = {
+ .start = frag_start, /* iterate over all zones. The same as in
+ * fragmentation. */
+ .next = frag_next,
+ .stop = frag_stop,
+ .show = zoneinfo_show,
+};
+
static char *vmstat_text[] = {
"nr_dirty",
"nr_writeback",
_
reply other threads:[~2003-07-09 8:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=16139.54945.45955.840028@laputa.namesys.com \
--to=nikita@namesys.com \
--cc=Linux-Kernel@Vger.Kernel.ORG \
/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
all inboxes | Powered by JetHome®