diff options
author | Andrea Arcangeli <aarcange@redhat.com> | 2011-01-13 18:46:58 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 20:32:43 -0500 |
commit | 79134171df238171daa4c024a42b77b401ccb00b (patch) | |
tree | af7872d5851e371d09b9fe7eb80f4809713c79fb | |
parent | b9bbfbe30ae088cc88a4b2ba7732baeebd1a0162 (diff) |
thp: transparent hugepage vmstat
Add hugepage stat information to /proc/vmstat and /proc/meminfo.
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Acked-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/proc/meminfo.c | 14 | ||||
-rw-r--r-- | include/linux/mmzone.h | 1 | ||||
-rw-r--r-- | mm/huge_memory.c | 3 | ||||
-rw-r--r-- | mm/rmap.c | 20 | ||||
-rw-r--r-- | mm/vmstat.c | 1 |
5 files changed, 34 insertions, 5 deletions
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c index a65239cfd97..ed257d14156 100644 --- a/fs/proc/meminfo.c +++ b/fs/proc/meminfo.c | |||
@@ -101,6 +101,9 @@ static int meminfo_proc_show(struct seq_file *m, void *v) | |||
101 | #ifdef CONFIG_MEMORY_FAILURE | 101 | #ifdef CONFIG_MEMORY_FAILURE |
102 | "HardwareCorrupted: %5lu kB\n" | 102 | "HardwareCorrupted: %5lu kB\n" |
103 | #endif | 103 | #endif |
104 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
105 | "AnonHugePages: %8lu kB\n" | ||
106 | #endif | ||
104 | , | 107 | , |
105 | K(i.totalram), | 108 | K(i.totalram), |
106 | K(i.freeram), | 109 | K(i.freeram), |
@@ -128,7 +131,12 @@ static int meminfo_proc_show(struct seq_file *m, void *v) | |||
128 | K(i.freeswap), | 131 | K(i.freeswap), |
129 | K(global_page_state(NR_FILE_DIRTY)), | 132 | K(global_page_state(NR_FILE_DIRTY)), |
130 | K(global_page_state(NR_WRITEBACK)), | 133 | K(global_page_state(NR_WRITEBACK)), |
131 | K(global_page_state(NR_ANON_PAGES)), | 134 | K(global_page_state(NR_ANON_PAGES) |
135 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
136 | + global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) * | ||
137 | HPAGE_PMD_NR | ||
138 | #endif | ||
139 | ), | ||
132 | K(global_page_state(NR_FILE_MAPPED)), | 140 | K(global_page_state(NR_FILE_MAPPED)), |
133 | K(global_page_state(NR_SHMEM)), | 141 | K(global_page_state(NR_SHMEM)), |
134 | K(global_page_state(NR_SLAB_RECLAIMABLE) + | 142 | K(global_page_state(NR_SLAB_RECLAIMABLE) + |
@@ -151,6 +159,10 @@ static int meminfo_proc_show(struct seq_file *m, void *v) | |||
151 | #ifdef CONFIG_MEMORY_FAILURE | 159 | #ifdef CONFIG_MEMORY_FAILURE |
152 | ,atomic_long_read(&mce_bad_pages) << (PAGE_SHIFT - 10) | 160 | ,atomic_long_read(&mce_bad_pages) << (PAGE_SHIFT - 10) |
153 | #endif | 161 | #endif |
162 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
163 | ,K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) * | ||
164 | HPAGE_PMD_NR) | ||
165 | #endif | ||
154 | ); | 166 | ); |
155 | 167 | ||
156 | hugetlb_report_meminfo(m); | 168 | hugetlb_report_meminfo(m); |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index dad3612a7e3..02ecb0189b1 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -114,6 +114,7 @@ enum zone_stat_item { | |||
114 | NUMA_LOCAL, /* allocation from local node */ | 114 | NUMA_LOCAL, /* allocation from local node */ |
115 | NUMA_OTHER, /* allocation from other node */ | 115 | NUMA_OTHER, /* allocation from other node */ |
116 | #endif | 116 | #endif |
117 | NR_ANON_TRANSPARENT_HUGEPAGES, | ||
117 | NR_VM_ZONE_STAT_ITEMS }; | 118 | NR_VM_ZONE_STAT_ITEMS }; |
118 | 119 | ||
119 | /* | 120 | /* |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index a313403b3c5..7101112a542 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -751,6 +751,9 @@ static void __split_huge_page_refcount(struct page *page) | |||
751 | lru_add_page_tail(zone, page, page_tail); | 751 | lru_add_page_tail(zone, page, page_tail); |
752 | } | 752 | } |
753 | 753 | ||
754 | __dec_zone_page_state(page, NR_ANON_TRANSPARENT_HUGEPAGES); | ||
755 | __mod_zone_page_state(zone, NR_ANON_PAGES, HPAGE_PMD_NR); | ||
756 | |||
754 | ClearPageCompound(page); | 757 | ClearPageCompound(page); |
755 | compound_unlock(page); | 758 | compound_unlock(page); |
756 | spin_unlock_irq(&zone->lru_lock); | 759 | spin_unlock_irq(&zone->lru_lock); |
@@ -882,8 +882,13 @@ void do_page_add_anon_rmap(struct page *page, | |||
882 | struct vm_area_struct *vma, unsigned long address, int exclusive) | 882 | struct vm_area_struct *vma, unsigned long address, int exclusive) |
883 | { | 883 | { |
884 | int first = atomic_inc_and_test(&page->_mapcount); | 884 | int first = atomic_inc_and_test(&page->_mapcount); |
885 | if (first) | 885 | if (first) { |
886 | __inc_zone_page_state(page, NR_ANON_PAGES); | 886 | if (!PageTransHuge(page)) |
887 | __inc_zone_page_state(page, NR_ANON_PAGES); | ||
888 | else | ||
889 | __inc_zone_page_state(page, | ||
890 | NR_ANON_TRANSPARENT_HUGEPAGES); | ||
891 | } | ||
887 | if (unlikely(PageKsm(page))) | 892 | if (unlikely(PageKsm(page))) |
888 | return; | 893 | return; |
889 | 894 | ||
@@ -911,7 +916,10 @@ void page_add_new_anon_rmap(struct page *page, | |||
911 | VM_BUG_ON(address < vma->vm_start || address >= vma->vm_end); | 916 | VM_BUG_ON(address < vma->vm_start || address >= vma->vm_end); |
912 | SetPageSwapBacked(page); | 917 | SetPageSwapBacked(page); |
913 | atomic_set(&page->_mapcount, 0); /* increment count (starts at -1) */ | 918 | atomic_set(&page->_mapcount, 0); /* increment count (starts at -1) */ |
914 | __inc_zone_page_state(page, NR_ANON_PAGES); | 919 | if (!PageTransHuge(page)) |
920 | __inc_zone_page_state(page, NR_ANON_PAGES); | ||
921 | else | ||
922 | __inc_zone_page_state(page, NR_ANON_TRANSPARENT_HUGEPAGES); | ||
915 | __page_set_anon_rmap(page, vma, address, 1); | 923 | __page_set_anon_rmap(page, vma, address, 1); |
916 | if (page_evictable(page, vma)) | 924 | if (page_evictable(page, vma)) |
917 | lru_cache_add_lru(page, LRU_ACTIVE_ANON); | 925 | lru_cache_add_lru(page, LRU_ACTIVE_ANON); |
@@ -964,7 +972,11 @@ void page_remove_rmap(struct page *page) | |||
964 | return; | 972 | return; |
965 | if (PageAnon(page)) { | 973 | if (PageAnon(page)) { |
966 | mem_cgroup_uncharge_page(page); | 974 | mem_cgroup_uncharge_page(page); |
967 | __dec_zone_page_state(page, NR_ANON_PAGES); | 975 | if (!PageTransHuge(page)) |
976 | __dec_zone_page_state(page, NR_ANON_PAGES); | ||
977 | else | ||
978 | __dec_zone_page_state(page, | ||
979 | NR_ANON_TRANSPARENT_HUGEPAGES); | ||
968 | } else { | 980 | } else { |
969 | __dec_zone_page_state(page, NR_FILE_MAPPED); | 981 | __dec_zone_page_state(page, NR_FILE_MAPPED); |
970 | mem_cgroup_update_file_mapped(page, -1); | 982 | mem_cgroup_update_file_mapped(page, -1); |
diff --git a/mm/vmstat.c b/mm/vmstat.c index 751a65e00aa..0c3b5048773 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
@@ -880,6 +880,7 @@ static const char * const vmstat_text[] = { | |||
880 | "numa_local", | 880 | "numa_local", |
881 | "numa_other", | 881 | "numa_other", |
882 | #endif | 882 | #endif |
883 | "nr_anon_transparent_hugepages", | ||
883 | "nr_dirty_threshold", | 884 | "nr_dirty_threshold", |
884 | "nr_dirty_background_threshold", | 885 | "nr_dirty_background_threshold", |
885 | 886 | ||