linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: js1304@gmail.com
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@kernel.org>,
	linux-mm@kvack.org, Vlastimil Babka <vbabka@suse.cz>,
	David Rientjes <rientjes@google.com>,
	Mel Gorman <mgorman@suse.de>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>
Subject: [RFC PATCH 4/5] mm/vmstat: introduce /proc/fraginfo to get fragmentation stat stably
Date: Fri, 13 Jan 2017 16:14:32 +0900	[thread overview]
Message-ID: <1484291673-2239-5-git-send-email-iamjoonsoo.kim@lge.com> (raw)
In-Reply-To: <1484291673-2239-1-git-send-email-iamjoonsoo.kim@lge.com>

From: Joonsoo Kim <iamjoonsoo.kim@lge.com>

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
 mm/vmstat.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index 0b218d9..9e5a862 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1448,6 +1448,47 @@ static int zoneinfo_open(struct inode *inode, struct file *file)
 	.release	= seq_release,
 };
 
+static void fraginfo_show_print(struct seq_file *m, pg_data_t *pgdat,
+						struct zone *zone)
+{
+	int order;
+	int index;
+
+	seq_printf(m, "Node %d, zone %8s ", pgdat->node_id, zone->name);
+	for (order = 0; order < MAX_ORDER; ++order) {
+		index = zone->free_area[order].unusable_free_avg /
+			(1 << UNUSABLE_INDEX_FACTOR);
+		seq_printf(m, "0.%03d ", index);
+	}
+	seq_putc(m, '\n');
+}
+
+static int fraginfo_show(struct seq_file *m, void *arg)
+{
+	pg_data_t *pgdat = (pg_data_t *)arg;
+	walk_zones_in_node(m, pgdat, fraginfo_show_print);
+	return 0;
+}
+
+static const struct seq_operations fraginfo_op = {
+	.start	= frag_start,
+	.next	= frag_next,
+	.stop	= frag_stop,
+	.show	= fraginfo_show,
+};
+
+static int fraginfo_open(struct inode *inode, struct file *file)
+{
+	return seq_open(file, &fraginfo_op);
+}
+
+static const struct file_operations fraginfo_file_operations = {
+	.open		= fraginfo_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= seq_release,
+};
+
 enum writeback_stat_item {
 	NR_DIRTY_THRESHOLD,
 	NR_DIRTY_BG_THRESHOLD,
@@ -1778,6 +1819,7 @@ static int __init setup_vmstat(void)
 	proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops);
 	proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations);
 	proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations);
+	proc_create("fraginfo", S_IRUGO, NULL, &fraginfo_file_operations);
 #endif
 	return 0;
 }
-- 
1.9.1

--
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:[~2017-01-13  7:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-13  7:14 [RFC PATCH 0/5] pro-active compaction js1304
2017-01-13  7:14 ` [RFC PATCH 1/5] mm/vmstat: retrieve suitable free pageblock information just once js1304
2017-01-19 10:47   ` Vlastimil Babka
2017-01-23  3:17     ` Joonsoo Kim
2017-01-19 11:51   ` Michal Hocko
2017-01-19 12:06     ` Vlastimil Babka
2017-01-13  7:14 ` [RFC PATCH 2/5] mm/vmstat: rename variables/functions about buddyinfo js1304
2017-01-13  7:14 ` [RFC PATCH 3/5] mm: introduce exponential moving average to unusable free index js1304
2017-01-19 12:52   ` Vlastimil Babka
2017-01-23  5:27     ` Joonsoo Kim
2017-01-13  7:14 ` js1304 [this message]
2017-01-13  7:14 ` [RFC PATCH 5/5] mm/compaction: run the compaction whenever fragmentation ratio exceeds the threshold js1304
2017-01-19 13:39   ` Vlastimil Babka
2017-01-13  9:24 ` [RFC PATCH 0/5] pro-active compaction Michal Hocko
2017-01-17  0:48   ` Joonsoo Kim

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=1484291673-2239-5-git-send-email-iamjoonsoo.kim@lge.com \
    --to=js1304@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@kernel.org \
    --cc=rientjes@google.com \
    --cc=vbabka@suse.cz \
    /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