diff options
author | Wang, Yalin <Yalin.Wang@sonymobile.com> | 2015-02-11 18:24:51 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-11 20:06:00 -0500 |
commit | 56873f43abdcd574b25105867a990f067747b2f4 (patch) | |
tree | be55c69ee61da7b4e10e46c89e62a2ca68adaf81 /fs/proc | |
parent | 1d148e218a0d0566b1c06f2f45f1436d53b049b2 (diff) |
mm:add KPF_ZERO_PAGE flag for /proc/kpageflags
Add KPF_ZERO_PAGE flag for zero_page, so that userspace processes can
detect zero_page in /proc/kpageflags, and then do memory analysis more
accurately.
Signed-off-by: Yalin Wang <yalin.wang@sonymobile.com>
Acked-by: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/page.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/fs/proc/page.c b/fs/proc/page.c index 1e3187da1fed..7eee2d8b97d9 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/ksm.h> | 5 | #include <linux/ksm.h> |
6 | #include <linux/mm.h> | 6 | #include <linux/mm.h> |
7 | #include <linux/mmzone.h> | 7 | #include <linux/mmzone.h> |
8 | #include <linux/huge_mm.h> | ||
8 | #include <linux/proc_fs.h> | 9 | #include <linux/proc_fs.h> |
9 | #include <linux/seq_file.h> | 10 | #include <linux/seq_file.h> |
10 | #include <linux/hugetlb.h> | 11 | #include <linux/hugetlb.h> |
@@ -121,9 +122,18 @@ u64 stable_page_flags(struct page *page) | |||
121 | * just checks PG_head/PG_tail, so we need to check PageLRU/PageAnon | 122 | * just checks PG_head/PG_tail, so we need to check PageLRU/PageAnon |
122 | * to make sure a given page is a thp, not a non-huge compound page. | 123 | * to make sure a given page is a thp, not a non-huge compound page. |
123 | */ | 124 | */ |
124 | else if (PageTransCompound(page) && (PageLRU(compound_head(page)) || | 125 | else if (PageTransCompound(page)) { |
125 | PageAnon(compound_head(page)))) | 126 | struct page *head = compound_head(page); |
126 | u |= 1 << KPF_THP; | 127 | |
128 | if (PageLRU(head) || PageAnon(head)) | ||
129 | u |= 1 << KPF_THP; | ||
130 | else if (is_huge_zero_page(head)) { | ||
131 | u |= 1 << KPF_ZERO_PAGE; | ||
132 | u |= 1 << KPF_THP; | ||
133 | } | ||
134 | } else if (is_zero_pfn(page_to_pfn(page))) | ||
135 | u |= 1 << KPF_ZERO_PAGE; | ||
136 | |||
127 | 137 | ||
128 | /* | 138 | /* |
129 | * Caveats on high order pages: page->_count will only be set | 139 | * Caveats on high order pages: page->_count will only be set |