diff options
-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 a65239cfd97e..ed257d141568 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 dad3612a7e39..02ecb0189b1d 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 a313403b3c5e..7101112a5429 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 751a65e00aac..0c3b5048773e 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 | ||