aboutsummaryrefslogtreecommitdiff
path: root/fs/proc/page.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/page.c')
-rw-r--r--fs/proc/page.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/proc/page.c b/fs/proc/page.c
index 6d8e6a9e93a..e647c55275d 100644
--- a/fs/proc/page.c
+++ b/fs/proc/page.c
@@ -115,6 +115,15 @@ u64 stable_page_flags(struct page *page)
u |= 1 << KPF_COMPOUND_TAIL;
if (PageHuge(page))
u |= 1 << KPF_HUGE;
+ /*
+ * 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/PageAnon
+ * to make sure a given page is a thp, not a non-huge compound page.
+ */
+ else if (PageTransCompound(page) && (PageLRU(compound_head(page)) ||
+ PageAnon(compound_head(page))))
+ u |= 1 << KPF_THP;
/*
* Caveats on high order pages: page->_count will only be set
@@ -209,4 +218,4 @@ static int __init proc_page_init(void)
proc_create("kpageflags", S_IRUSR, NULL, &proc_kpageflags_operations);
return 0;
}
-module_init(proc_page_init);
+fs_initcall(proc_page_init);