aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>2014-01-23 18:52:53 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 19:36:50 -0500
commite3bba3c3c90cd434c1ccb9e5dc704a96baf9541c (patch)
tree86897834d0ccbe93f8b44249569a2be70486b573
parent8ff69e2c85f84b6b371e3c1d01207e73c0500125 (diff)
fs/proc/page.c: add PageAnon check to surely detect thp
stable_page_flags() checks !PageHuge && PageTransCompound && PageLRU to know that a specified page is thp or not. But sometimes it's not enough and we fail to detect thp when the thp is on pagevec. This happens only for a few seconds after LRU list operations, but it makes it difficult to control our applications depending on this flag. So this patch adds another check PageAnon to detect thps on pagevec. It might not give the future extensibility for thp pagecache, but it's OK at least for now. Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: David Rientjes <rientjes@google.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Wu Fengguang <fengguang.wu@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/proc/page.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/proc/page.c b/fs/proc/page.c
index b8730d9ebaee..cab84b6272ed 100644
--- a/fs/proc/page.c
+++ b/fs/proc/page.c
@@ -118,10 +118,12 @@ u64 stable_page_flags(struct page *page)
118 /* 118 /*
119 * PageTransCompound can be true for non-huge compound pages (slab 119 * PageTransCompound can be true for non-huge compound pages (slab
120 * pages or pages allocated by drivers with __GFP_COMP) because it 120 * pages or pages allocated by drivers with __GFP_COMP) because it
121 * just checks PG_head/PG_tail, so we need to check PageLRU to make 121 * just checks PG_head/PG_tail, so we need to check PageLRU/PageAnon
122 * sure a given page is a thp, not a non-huge compound page. 122 * to make sure a given page is a thp, not a non-huge compound page.
123 */ 123 */
124 else if (PageTransCompound(page) && PageLRU(compound_trans_head(page))) 124 else if (PageTransCompound(page) &&
125 (PageLRU(compound_trans_head(page)) ||
126 PageAnon(compound_trans_head(page))))
125 u |= 1 << KPF_THP; 127 u |= 1 << KPF_THP;
126 128
127 /* 129 /*