diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2013-09-12 18:13:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-12 18:38:03 -0400 |
commit | 3cd14fcd3f128d5eba8575491cb4e1999ee1bad2 (patch) | |
tree | 5a2188a3349b339fe1365a13d85ac2a7acd4032b /mm/rmap.c | |
parent | 7caef26767c1727d7abfbbbfbe8b2bb473430d48 (diff) |
thp: account anon transparent huge pages into NR_ANON_PAGES
We use NR_ANON_PAGES as base for reporting AnonPages to user. There's
not much sense in not accounting transparent huge pages there, but add
them on printing to user.
Let's account transparent huge pages in NR_ANON_PAGES in the first place.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Hugh Dickins <hughd@google.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Matthew Wilcox <willy@linux.intel.com>
Cc: Hillf Danton <dhillf@gmail.com>
Cc: Ning Qu <quning@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/rmap.c')
-rw-r--r-- | mm/rmap.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -1052,11 +1052,11 @@ void do_page_add_anon_rmap(struct page *page, | |||
1052 | { | 1052 | { |
1053 | int first = atomic_inc_and_test(&page->_mapcount); | 1053 | int first = atomic_inc_and_test(&page->_mapcount); |
1054 | if (first) { | 1054 | if (first) { |
1055 | if (!PageTransHuge(page)) | 1055 | if (PageTransHuge(page)) |
1056 | __inc_zone_page_state(page, NR_ANON_PAGES); | ||
1057 | else | ||
1058 | __inc_zone_page_state(page, | 1056 | __inc_zone_page_state(page, |
1059 | NR_ANON_TRANSPARENT_HUGEPAGES); | 1057 | NR_ANON_TRANSPARENT_HUGEPAGES); |
1058 | __mod_zone_page_state(page_zone(page), NR_ANON_PAGES, | ||
1059 | hpage_nr_pages(page)); | ||
1060 | } | 1060 | } |
1061 | if (unlikely(PageKsm(page))) | 1061 | if (unlikely(PageKsm(page))) |
1062 | return; | 1062 | return; |
@@ -1085,10 +1085,10 @@ void page_add_new_anon_rmap(struct page *page, | |||
1085 | VM_BUG_ON(address < vma->vm_start || address >= vma->vm_end); | 1085 | VM_BUG_ON(address < vma->vm_start || address >= vma->vm_end); |
1086 | SetPageSwapBacked(page); | 1086 | SetPageSwapBacked(page); |
1087 | atomic_set(&page->_mapcount, 0); /* increment count (starts at -1) */ | 1087 | atomic_set(&page->_mapcount, 0); /* increment count (starts at -1) */ |
1088 | if (!PageTransHuge(page)) | 1088 | if (PageTransHuge(page)) |
1089 | __inc_zone_page_state(page, NR_ANON_PAGES); | ||
1090 | else | ||
1091 | __inc_zone_page_state(page, NR_ANON_TRANSPARENT_HUGEPAGES); | 1089 | __inc_zone_page_state(page, NR_ANON_TRANSPARENT_HUGEPAGES); |
1090 | __mod_zone_page_state(page_zone(page), NR_ANON_PAGES, | ||
1091 | hpage_nr_pages(page)); | ||
1092 | __page_set_anon_rmap(page, vma, address, 1); | 1092 | __page_set_anon_rmap(page, vma, address, 1); |
1093 | if (!mlocked_vma_newpage(vma, page)) { | 1093 | if (!mlocked_vma_newpage(vma, page)) { |
1094 | SetPageActive(page); | 1094 | SetPageActive(page); |
@@ -1148,11 +1148,11 @@ void page_remove_rmap(struct page *page) | |||
1148 | goto out; | 1148 | goto out; |
1149 | if (anon) { | 1149 | if (anon) { |
1150 | mem_cgroup_uncharge_page(page); | 1150 | mem_cgroup_uncharge_page(page); |
1151 | if (!PageTransHuge(page)) | 1151 | if (PageTransHuge(page)) |
1152 | __dec_zone_page_state(page, NR_ANON_PAGES); | ||
1153 | else | ||
1154 | __dec_zone_page_state(page, | 1152 | __dec_zone_page_state(page, |
1155 | NR_ANON_TRANSPARENT_HUGEPAGES); | 1153 | NR_ANON_TRANSPARENT_HUGEPAGES); |
1154 | __mod_zone_page_state(page_zone(page), NR_ANON_PAGES, | ||
1155 | -hpage_nr_pages(page)); | ||
1156 | } else { | 1156 | } else { |
1157 | __dec_zone_page_state(page, NR_FILE_MAPPED); | 1157 | __dec_zone_page_state(page, NR_FILE_MAPPED); |
1158 | mem_cgroup_dec_page_stat(page, MEM_CGROUP_STAT_FILE_MAPPED); | 1158 | mem_cgroup_dec_page_stat(page, MEM_CGROUP_STAT_FILE_MAPPED); |