summaryrefslogtreecommitdiffstats
path: root/include/linux/huge_mm.h
diff options
context:
space:
mode:
authorRik van Riel <riel@redhat.com>2011-01-13 15:47:13 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 17:32:46 -0800
commit2c888cfbc1b45508a44763d85ba2e8ac43faff5f (patch)
tree9a7f2214e5d6a01d5724ae63d4d50cddeb2293ff /include/linux/huge_mm.h
parent97562cd243298acf573620c764a1037bd545c9bc (diff)
downloadlinux-stable-2c888cfbc1b45508a44763d85ba2e8ac43faff5f.tar.gz
linux-stable-2c888cfbc1b45508a44763d85ba2e8ac43faff5f.tar.bz2
linux-stable-2c888cfbc1b45508a44763d85ba2e8ac43faff5f.zip
thp: fix anon memory statistics with transparent hugepages
Count each transparent hugepage as HPAGE_PMD_NR pages in the LRU statistics, so the Active(anon) and Inactive(anon) statistics in /proc/meminfo are correct. Signed-off-by: Rik van Riel <riel@redhat.com> Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/huge_mm.h')
-rw-r--r--include/linux/huge_mm.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 827595228734..9b48c24df260 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -117,11 +117,19 @@ static inline void vma_adjust_trans_huge(struct vm_area_struct *vma,
return;
__vma_adjust_trans_huge(vma, start, end, adjust_next);
}
+static inline int hpage_nr_pages(struct page *page)
+{
+ if (unlikely(PageTransHuge(page)))
+ return HPAGE_PMD_NR;
+ return 1;
+}
#else /* CONFIG_TRANSPARENT_HUGEPAGE */
#define HPAGE_PMD_SHIFT ({ BUG(); 0; })
#define HPAGE_PMD_MASK ({ BUG(); 0; })
#define HPAGE_PMD_SIZE ({ BUG(); 0; })
+#define hpage_nr_pages(x) 1
+
#define transparent_hugepage_enabled(__vma) 0
#define transparent_hugepage_flags 0UL