fs/proc/page.c: add PageAnon check to surely detect thp
[platform/adaptation/renesas_rcar/renesas_kernel.git] / fs / proc / page.c
index b8730d9..cab84b6 100644 (file)
@@ -118,10 +118,12 @@ u64 stable_page_flags(struct page *page)
        /*
         * PageTransCompound can be true for non-huge compound pages (slab
         * pages or pages allocated by drivers with __GFP_COMP) because it
-        * just checks PG_head/PG_tail, so we need to check PageLRU to make
-        * sure a given page is a thp, not a non-huge compound page.
+        * just checks PG_head/PG_tail, so we need to check PageLRU/PageAnon
+        * to make sure a given page is a thp, not a non-huge compound page.
         */
-       else if (PageTransCompound(page) && PageLRU(compound_trans_head(page)))
+       else if (PageTransCompound(page) &&
+                (PageLRU(compound_trans_head(page)) ||
+                 PageAnon(compound_trans_head(page))))
                u |= 1 << KPF_THP;
 
        /*