aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/node.c14
-rw-r--r--include/linux/vmstat.h4
-rw-r--r--mm/vmstat.c261
3 files changed, 144 insertions, 135 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c
index b3b72d64e805..793f796c4da3 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -7,6 +7,7 @@
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/mm.h> 8#include <linux/mm.h>
9#include <linux/memory.h> 9#include <linux/memory.h>
10#include <linux/vmstat.h>
10#include <linux/node.h> 11#include <linux/node.h>
11#include <linux/hugetlb.h> 12#include <linux/hugetlb.h>
12#include <linux/compaction.h> 13#include <linux/compaction.h>
@@ -179,11 +180,14 @@ static ssize_t node_read_vmstat(struct sys_device *dev,
179 struct sysdev_attribute *attr, char *buf) 180 struct sysdev_attribute *attr, char *buf)
180{ 181{
181 int nid = dev->id; 182 int nid = dev->id;
182 return sprintf(buf, 183 int i;
183 "nr_written %lu\n" 184 int n = 0;
184 "nr_dirtied %lu\n", 185
185 node_page_state(nid, NR_WRITTEN), 186 for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
186 node_page_state(nid, NR_DIRTIED)); 187 n += sprintf(buf+n, "%s %lu\n", vmstat_text[i],
188 node_page_state(nid, i));
189
190 return n;
187} 191}
188static SYSDEV_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL); 192static SYSDEV_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL);
189 193
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 2b3831b58aa4..e73d1030f2f7 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -313,6 +313,8 @@ static inline void __dec_zone_page_state(struct page *page,
313#define set_pgdat_percpu_threshold(pgdat, callback) { } 313#define set_pgdat_percpu_threshold(pgdat, callback) { }
314 314
315static inline void refresh_cpu_vm_stats(int cpu) { } 315static inline void refresh_cpu_vm_stats(int cpu) { }
316#endif 316#endif /* CONFIG_SMP */
317
318extern const char * const vmstat_text[];
317 319
318#endif /* _LINUX_VMSTAT_H */ 320#endif /* _LINUX_VMSTAT_H */
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 897ea9e88238..209546a8bdd5 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -659,6 +659,138 @@ static void walk_zones_in_node(struct seq_file *m, pg_data_t *pgdat,
659} 659}
660#endif 660#endif
661 661
662#if defined(CONFIG_PROC_FS) || defined(CONFIG_SYSFS)
663#ifdef CONFIG_ZONE_DMA
664#define TEXT_FOR_DMA(xx) xx "_dma",
665#else
666#define TEXT_FOR_DMA(xx)
667#endif
668
669#ifdef CONFIG_ZONE_DMA32
670#define TEXT_FOR_DMA32(xx) xx "_dma32",
671#else
672#define TEXT_FOR_DMA32(xx)
673#endif
674
675#ifdef CONFIG_HIGHMEM
676#define TEXT_FOR_HIGHMEM(xx) xx "_high",
677#else
678#define TEXT_FOR_HIGHMEM(xx)
679#endif
680
681#define TEXTS_FOR_ZONES(xx) TEXT_FOR_DMA(xx) TEXT_FOR_DMA32(xx) xx "_normal", \
682 TEXT_FOR_HIGHMEM(xx) xx "_movable",
683
684const char * const vmstat_text[] = {
685 /* Zoned VM counters */
686 "nr_free_pages",
687 "nr_inactive_anon",
688 "nr_active_anon",
689 "nr_inactive_file",
690 "nr_active_file",
691 "nr_unevictable",
692 "nr_mlock",
693 "nr_anon_pages",
694 "nr_mapped",
695 "nr_file_pages",
696 "nr_dirty",
697 "nr_writeback",
698 "nr_slab_reclaimable",
699 "nr_slab_unreclaimable",
700 "nr_page_table_pages",
701 "nr_kernel_stack",
702 "nr_unstable",
703 "nr_bounce",
704 "nr_vmscan_write",
705 "nr_writeback_temp",
706 "nr_isolated_anon",
707 "nr_isolated_file",
708 "nr_shmem",
709 "nr_dirtied",
710 "nr_written",
711
712#ifdef CONFIG_NUMA
713 "numa_hit",
714 "numa_miss",
715 "numa_foreign",
716 "numa_interleave",
717 "numa_local",
718 "numa_other",
719#endif
720 "nr_anon_transparent_hugepages",
721 "nr_dirty_threshold",
722 "nr_dirty_background_threshold",
723
724#ifdef CONFIG_VM_EVENT_COUNTERS
725 "pgpgin",
726 "pgpgout",
727 "pswpin",
728 "pswpout",
729
730 TEXTS_FOR_ZONES("pgalloc")
731
732 "pgfree",
733 "pgactivate",
734 "pgdeactivate",
735
736 "pgfault",
737 "pgmajfault",
738
739 TEXTS_FOR_ZONES("pgrefill")
740 TEXTS_FOR_ZONES("pgsteal")
741 TEXTS_FOR_ZONES("pgscan_kswapd")
742 TEXTS_FOR_ZONES("pgscan_direct")
743
744#ifdef CONFIG_NUMA
745 "zone_reclaim_failed",
746#endif
747 "pginodesteal",
748 "slabs_scanned",
749 "kswapd_steal",
750 "kswapd_inodesteal",
751 "kswapd_low_wmark_hit_quickly",
752 "kswapd_high_wmark_hit_quickly",
753 "kswapd_skip_congestion_wait",
754 "pageoutrun",
755 "allocstall",
756
757 "pgrotated",
758
759#ifdef CONFIG_COMPACTION
760 "compact_blocks_moved",
761 "compact_pages_moved",
762 "compact_pagemigrate_failed",
763 "compact_stall",
764 "compact_fail",
765 "compact_success",
766#endif
767
768#ifdef CONFIG_HUGETLB_PAGE
769 "htlb_buddy_alloc_success",
770 "htlb_buddy_alloc_fail",
771#endif
772 "unevictable_pgs_culled",
773 "unevictable_pgs_scanned",
774 "unevictable_pgs_rescued",
775 "unevictable_pgs_mlocked",
776 "unevictable_pgs_munlocked",
777 "unevictable_pgs_cleared",
778 "unevictable_pgs_stranded",
779 "unevictable_pgs_mlockfreed",
780
781#ifdef CONFIG_TRANSPARENT_HUGEPAGE
782 "thp_fault_alloc",
783 "thp_fault_fallback",
784 "thp_collapse_alloc",
785 "thp_collapse_alloc_failed",
786 "thp_split",
787#endif
788
789#endif /* CONFIG_VM_EVENTS_COUNTERS */
790};
791#endif /* CONFIG_PROC_FS || CONFIG_SYSFS */
792
793
662#ifdef CONFIG_PROC_FS 794#ifdef CONFIG_PROC_FS
663static void frag_show_print(struct seq_file *m, pg_data_t *pgdat, 795static void frag_show_print(struct seq_file *m, pg_data_t *pgdat,
664 struct zone *zone) 796 struct zone *zone)
@@ -831,135 +963,6 @@ static const struct file_operations pagetypeinfo_file_ops = {
831 .release = seq_release, 963 .release = seq_release,
832}; 964};
833 965
834#ifdef CONFIG_ZONE_DMA
835#define TEXT_FOR_DMA(xx) xx "_dma",
836#else
837#define TEXT_FOR_DMA(xx)
838#endif
839
840#ifdef CONFIG_ZONE_DMA32
841#define TEXT_FOR_DMA32(xx) xx "_dma32",
842#else
843#define TEXT_FOR_DMA32(xx)
844#endif
845
846#ifdef CONFIG_HIGHMEM
847#define TEXT_FOR_HIGHMEM(xx) xx "_high",
848#else
849#define TEXT_FOR_HIGHMEM(xx)
850#endif
851
852#define TEXTS_FOR_ZONES(xx) TEXT_FOR_DMA(xx) TEXT_FOR_DMA32(xx) xx "_normal", \
853 TEXT_FOR_HIGHMEM(xx) xx "_movable",
854
855static const char * const vmstat_text[] = {
856 /* Zoned VM counters */
857 "nr_free_pages",
858 "nr_inactive_anon",
859 "nr_active_anon",
860 "nr_inactive_file",
861 "nr_active_file",
862 "nr_unevictable",
863 "nr_mlock",
864 "nr_anon_pages",
865 "nr_mapped",
866 "nr_file_pages",
867 "nr_dirty",
868 "nr_writeback",
869 "nr_slab_reclaimable",
870 "nr_slab_unreclaimable",
871 "nr_page_table_pages",
872 "nr_kernel_stack",
873 "nr_unstable",
874 "nr_bounce",
875 "nr_vmscan_write",
876 "nr_writeback_temp",
877 "nr_isolated_anon",
878 "nr_isolated_file",
879 "nr_shmem",
880 "nr_dirtied",
881 "nr_written",
882
883#ifdef CONFIG_NUMA
884 "numa_hit",
885 "numa_miss",
886 "numa_foreign",
887 "numa_interleave",
888 "numa_local",
889 "numa_other",
890#endif
891 "nr_anon_transparent_hugepages",
892 "nr_dirty_threshold",
893 "nr_dirty_background_threshold",
894
895#ifdef CONFIG_VM_EVENT_COUNTERS
896 "pgpgin",
897 "pgpgout",
898 "pswpin",
899 "pswpout",
900
901 TEXTS_FOR_ZONES("pgalloc")
902
903 "pgfree",
904 "pgactivate",
905 "pgdeactivate",
906
907 "pgfault",
908 "pgmajfault",
909
910 TEXTS_FOR_ZONES("pgrefill")
911 TEXTS_FOR_ZONES("pgsteal")
912 TEXTS_FOR_ZONES("pgscan_kswapd")
913 TEXTS_FOR_ZONES("pgscan_direct")
914
915#ifdef CONFIG_NUMA
916 "zone_reclaim_failed",
917#endif
918 "pginodesteal",
919 "slabs_scanned",
920 "kswapd_steal",
921 "kswapd_inodesteal",
922 "kswapd_low_wmark_hit_quickly",
923 "kswapd_high_wmark_hit_quickly",
924 "kswapd_skip_congestion_wait",
925 "pageoutrun",
926 "allocstall",
927
928 "pgrotated",
929
930#ifdef CONFIG_COMPACTION
931 "compact_blocks_moved",
932 "compact_pages_moved",
933 "compact_pagemigrate_failed",
934 "compact_stall",
935 "compact_fail",
936 "compact_success",
937#endif
938
939#ifdef CONFIG_HUGETLB_PAGE
940 "htlb_buddy_alloc_success",
941 "htlb_buddy_alloc_fail",
942#endif
943 "unevictable_pgs_culled",
944 "unevictable_pgs_scanned",
945 "unevictable_pgs_rescued",
946 "unevictable_pgs_mlocked",
947 "unevictable_pgs_munlocked",
948 "unevictable_pgs_cleared",
949 "unevictable_pgs_stranded",
950 "unevictable_pgs_mlockfreed",
951
952#ifdef CONFIG_TRANSPARENT_HUGEPAGE
953 "thp_fault_alloc",
954 "thp_fault_fallback",
955 "thp_collapse_alloc",
956 "thp_collapse_alloc_failed",
957 "thp_split",
958#endif
959
960#endif /* CONFIG_VM_EVENTS_COUNTERS */
961};
962
963static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, 966static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,
964 struct zone *zone) 967 struct zone *zone)
965{ 968{