aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmstat.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/vmstat.c')
-rw-r--r--mm/vmstat.c102
1 files changed, 89 insertions, 13 deletions
diff --git a/mm/vmstat.c b/mm/vmstat.c
index d7826af2fb07..c3ccfda23adc 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -8,7 +8,7 @@
8 * Copyright (C) 2006 Silicon Graphics, Inc., 8 * Copyright (C) 2006 Silicon Graphics, Inc.,
9 * Christoph Lameter <christoph@lameter.com> 9 * Christoph Lameter <christoph@lameter.com>
10 */ 10 */
11 11#include <linux/fs.h>
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/err.h> 13#include <linux/err.h>
14#include <linux/module.h> 14#include <linux/module.h>
@@ -384,7 +384,7 @@ void zone_statistics(struct zone *preferred_zone, struct zone *z)
384#endif 384#endif
385 385
386#ifdef CONFIG_PROC_FS 386#ifdef CONFIG_PROC_FS
387 387#include <linux/proc_fs.h>
388#include <linux/seq_file.h> 388#include <linux/seq_file.h>
389 389
390static char * const migratetype_names[MIGRATE_TYPES] = { 390static char * const migratetype_names[MIGRATE_TYPES] = {
@@ -581,20 +581,44 @@ static int pagetypeinfo_show(struct seq_file *m, void *arg)
581 return 0; 581 return 0;
582} 582}
583 583
584const struct seq_operations fragmentation_op = { 584static const struct seq_operations fragmentation_op = {
585 .start = frag_start, 585 .start = frag_start,
586 .next = frag_next, 586 .next = frag_next,
587 .stop = frag_stop, 587 .stop = frag_stop,
588 .show = frag_show, 588 .show = frag_show,
589}; 589};
590 590
591const struct seq_operations pagetypeinfo_op = { 591static int fragmentation_open(struct inode *inode, struct file *file)
592{
593 return seq_open(file, &fragmentation_op);
594}
595
596static const struct file_operations fragmentation_file_operations = {
597 .open = fragmentation_open,
598 .read = seq_read,
599 .llseek = seq_lseek,
600 .release = seq_release,
601};
602
603static const struct seq_operations pagetypeinfo_op = {
592 .start = frag_start, 604 .start = frag_start,
593 .next = frag_next, 605 .next = frag_next,
594 .stop = frag_stop, 606 .stop = frag_stop,
595 .show = pagetypeinfo_show, 607 .show = pagetypeinfo_show,
596}; 608};
597 609
610static int pagetypeinfo_open(struct inode *inode, struct file *file)
611{
612 return seq_open(file, &pagetypeinfo_op);
613}
614
615static const struct file_operations pagetypeinfo_file_ops = {
616 .open = pagetypeinfo_open,
617 .read = seq_read,
618 .llseek = seq_lseek,
619 .release = seq_release,
620};
621
598#ifdef CONFIG_ZONE_DMA 622#ifdef CONFIG_ZONE_DMA
599#define TEXT_FOR_DMA(xx) xx "_dma", 623#define TEXT_FOR_DMA(xx) xx "_dma",
600#else 624#else
@@ -619,8 +643,14 @@ const struct seq_operations pagetypeinfo_op = {
619static const char * const vmstat_text[] = { 643static const char * const vmstat_text[] = {
620 /* Zoned VM counters */ 644 /* Zoned VM counters */
621 "nr_free_pages", 645 "nr_free_pages",
622 "nr_inactive", 646 "nr_inactive_anon",
623 "nr_active", 647 "nr_active_anon",
648 "nr_inactive_file",
649 "nr_active_file",
650#ifdef CONFIG_UNEVICTABLE_LRU
651 "nr_unevictable",
652 "nr_mlock",
653#endif
624 "nr_anon_pages", 654 "nr_anon_pages",
625 "nr_mapped", 655 "nr_mapped",
626 "nr_file_pages", 656 "nr_file_pages",
@@ -675,6 +705,16 @@ static const char * const vmstat_text[] = {
675 "htlb_buddy_alloc_success", 705 "htlb_buddy_alloc_success",
676 "htlb_buddy_alloc_fail", 706 "htlb_buddy_alloc_fail",
677#endif 707#endif
708#ifdef CONFIG_UNEVICTABLE_LRU
709 "unevictable_pgs_culled",
710 "unevictable_pgs_scanned",
711 "unevictable_pgs_rescued",
712 "unevictable_pgs_mlocked",
713 "unevictable_pgs_munlocked",
714 "unevictable_pgs_cleared",
715 "unevictable_pgs_stranded",
716 "unevictable_pgs_mlockfreed",
717#endif
678#endif 718#endif
679}; 719};
680 720
@@ -688,7 +728,7 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,
688 "\n min %lu" 728 "\n min %lu"
689 "\n low %lu" 729 "\n low %lu"
690 "\n high %lu" 730 "\n high %lu"
691 "\n scanned %lu (a: %lu i: %lu)" 731 "\n scanned %lu (aa: %lu ia: %lu af: %lu if: %lu)"
692 "\n spanned %lu" 732 "\n spanned %lu"
693 "\n present %lu", 733 "\n present %lu",
694 zone_page_state(zone, NR_FREE_PAGES), 734 zone_page_state(zone, NR_FREE_PAGES),
@@ -696,7 +736,10 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,
696 zone->pages_low, 736 zone->pages_low,
697 zone->pages_high, 737 zone->pages_high,
698 zone->pages_scanned, 738 zone->pages_scanned,
699 zone->nr_scan_active, zone->nr_scan_inactive, 739 zone->lru[LRU_ACTIVE_ANON].nr_scan,
740 zone->lru[LRU_INACTIVE_ANON].nr_scan,
741 zone->lru[LRU_ACTIVE_FILE].nr_scan,
742 zone->lru[LRU_INACTIVE_FILE].nr_scan,
700 zone->spanned_pages, 743 zone->spanned_pages,
701 zone->present_pages); 744 zone->present_pages);
702 745
@@ -733,10 +776,12 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,
733 seq_printf(m, 776 seq_printf(m,
734 "\n all_unreclaimable: %u" 777 "\n all_unreclaimable: %u"
735 "\n prev_priority: %i" 778 "\n prev_priority: %i"
736 "\n start_pfn: %lu", 779 "\n start_pfn: %lu"
780 "\n inactive_ratio: %u",
737 zone_is_all_unreclaimable(zone), 781 zone_is_all_unreclaimable(zone),
738 zone->prev_priority, 782 zone->prev_priority,
739 zone->zone_start_pfn); 783 zone->zone_start_pfn,
784 zone->inactive_ratio);
740 seq_putc(m, '\n'); 785 seq_putc(m, '\n');
741} 786}
742 787
@@ -750,7 +795,7 @@ static int zoneinfo_show(struct seq_file *m, void *arg)
750 return 0; 795 return 0;
751} 796}
752 797
753const struct seq_operations zoneinfo_op = { 798static const struct seq_operations zoneinfo_op = {
754 .start = frag_start, /* iterate over all zones. The same as in 799 .start = frag_start, /* iterate over all zones. The same as in
755 * fragmentation. */ 800 * fragmentation. */
756 .next = frag_next, 801 .next = frag_next,
@@ -758,6 +803,18 @@ const struct seq_operations zoneinfo_op = {
758 .show = zoneinfo_show, 803 .show = zoneinfo_show,
759}; 804};
760 805
806static int zoneinfo_open(struct inode *inode, struct file *file)
807{
808 return seq_open(file, &zoneinfo_op);
809}
810
811static const struct file_operations proc_zoneinfo_file_operations = {
812 .open = zoneinfo_open,
813 .read = seq_read,
814 .llseek = seq_lseek,
815 .release = seq_release,
816};
817
761static void *vmstat_start(struct seq_file *m, loff_t *pos) 818static void *vmstat_start(struct seq_file *m, loff_t *pos)
762{ 819{
763 unsigned long *v; 820 unsigned long *v;
@@ -813,13 +870,24 @@ static void vmstat_stop(struct seq_file *m, void *arg)
813 m->private = NULL; 870 m->private = NULL;
814} 871}
815 872
816const struct seq_operations vmstat_op = { 873static const struct seq_operations vmstat_op = {
817 .start = vmstat_start, 874 .start = vmstat_start,
818 .next = vmstat_next, 875 .next = vmstat_next,
819 .stop = vmstat_stop, 876 .stop = vmstat_stop,
820 .show = vmstat_show, 877 .show = vmstat_show,
821}; 878};
822 879
880static int vmstat_open(struct inode *inode, struct file *file)
881{
882 return seq_open(file, &vmstat_op);
883}
884
885static const struct file_operations proc_vmstat_file_operations = {
886 .open = vmstat_open,
887 .read = seq_read,
888 .llseek = seq_lseek,
889 .release = seq_release,
890};
823#endif /* CONFIG_PROC_FS */ 891#endif /* CONFIG_PROC_FS */
824 892
825#ifdef CONFIG_SMP 893#ifdef CONFIG_SMP
@@ -877,9 +945,11 @@ static int __cpuinit vmstat_cpuup_callback(struct notifier_block *nfb,
877 945
878static struct notifier_block __cpuinitdata vmstat_notifier = 946static struct notifier_block __cpuinitdata vmstat_notifier =
879 { &vmstat_cpuup_callback, NULL, 0 }; 947 { &vmstat_cpuup_callback, NULL, 0 };
948#endif
880 949
881static int __init setup_vmstat(void) 950static int __init setup_vmstat(void)
882{ 951{
952#ifdef CONFIG_SMP
883 int cpu; 953 int cpu;
884 954
885 refresh_zone_stat_thresholds(); 955 refresh_zone_stat_thresholds();
@@ -887,7 +957,13 @@ static int __init setup_vmstat(void)
887 957
888 for_each_online_cpu(cpu) 958 for_each_online_cpu(cpu)
889 start_cpu_timer(cpu); 959 start_cpu_timer(cpu);
960#endif
961#ifdef CONFIG_PROC_FS
962 proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations);
963 proc_create("pagetypeinfo", S_IRUGO, NULL, &pagetypeinfo_file_ops);
964 proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations);
965 proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations);
966#endif
890 return 0; 967 return 0;
891} 968}
892module_init(setup_vmstat) 969module_init(setup_vmstat)
893#endif