|
@@ -516,6 +516,27 @@ static inline int PageTransCompound(struct page *page)
|
|
return PageCompound(page);
|
|
return PageCompound(page);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * PageTransCompoundMap is the same as PageTransCompound, but it also
|
|
|
|
+ * guarantees the primary MMU has the entire compound page mapped
|
|
|
|
+ * through pmd_trans_huge, which in turn guarantees the secondary MMUs
|
|
|
|
+ * can also map the entire compound page. This allows the secondary
|
|
|
|
+ * MMUs to call get_user_pages() only once for each compound page and
|
|
|
|
+ * to immediately map the entire compound page with a single secondary
|
|
|
|
+ * MMU fault. If there will be a pmd split later, the secondary MMUs
|
|
|
|
+ * will get an update through the MMU notifier invalidation through
|
|
|
|
+ * split_huge_pmd().
|
|
|
|
+ *
|
|
|
|
+ * Unlike PageTransCompound, this is safe to be called only while
|
|
|
|
+ * split_huge_pmd() cannot run from under us, like if protected by the
|
|
|
|
+ * MMU notifier, otherwise it may result in page->_mapcount < 0 false
|
|
|
|
+ * positives.
|
|
|
|
+ */
|
|
|
|
+static inline int PageTransCompoundMap(struct page *page)
|
|
|
|
+{
|
|
|
|
+ return PageTransCompound(page) && atomic_read(&page->_mapcount) < 0;
|
|
|
|
+}
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* PageTransTail returns true for both transparent huge pages
|
|
* PageTransTail returns true for both transparent huge pages
|
|
* and hugetlbfs pages, so it should only be called when it's known
|
|
* and hugetlbfs pages, so it should only be called when it's known
|
|
@@ -559,6 +580,7 @@ static inline int TestClearPageDoubleMap(struct page *page)
|
|
#else
|
|
#else
|
|
TESTPAGEFLAG_FALSE(TransHuge)
|
|
TESTPAGEFLAG_FALSE(TransHuge)
|
|
TESTPAGEFLAG_FALSE(TransCompound)
|
|
TESTPAGEFLAG_FALSE(TransCompound)
|
|
|
|
+TESTPAGEFLAG_FALSE(TransCompoundMap)
|
|
TESTPAGEFLAG_FALSE(TransTail)
|
|
TESTPAGEFLAG_FALSE(TransTail)
|
|
TESTPAGEFLAG_FALSE(DoubleMap)
|
|
TESTPAGEFLAG_FALSE(DoubleMap)
|
|
TESTSETFLAG_FALSE(DoubleMap)
|
|
TESTSETFLAG_FALSE(DoubleMap)
|