aboutsummaryrefslogtreecommitdiff
path: root/include/linux/mm.h
diff options
context:
space:
mode:
authorGravatar Matthew Wilcox (Oracle) <willy@infradead.org> 2021-11-28 14:24:43 -0500
committerGravatar Matthew Wilcox (Oracle) <willy@infradead.org> 2022-01-04 13:15:33 -0500
commit5bf34d7c7ffe773c3b3c1b6ebf39e0f34a2436ec (patch)
treecb9a87d4622bf533a274b38e7b321c96f4b9f45f /include/linux/mm.h
parentiov_iter: Convert iter_xarray to use folios (diff)
downloadlinux-5bf34d7c7ffe773c3b3c1b6ebf39e0f34a2436ec.tar.gz
linux-5bf34d7c7ffe773c3b3c1b6ebf39e0f34a2436ec.tar.bz2
linux-5bf34d7c7ffe773c3b3c1b6ebf39e0f34a2436ec.zip
mm: Add folio_test_pmd_mappable()
Add a predicate to determine if the folio might be mapped by a PMD entry. If CONFIG_TRANSPARENT_HUGEPAGE is disabled, we know it can't be, even if it's large enough. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: William Kucharski <william.kucharski@oracle.com>
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r--include/linux/mm.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index a7e4a9e7d807..72ca04f16711 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -714,6 +714,27 @@ int vma_is_stack_for_current(struct vm_area_struct *vma);
struct mmu_gather;
struct inode;
+static inline unsigned int compound_order(struct page *page)
+{
+ if (!PageHead(page))
+ return 0;
+ return page[1].compound_order;
+}
+
+/**
+ * folio_order - The allocation order of a folio.
+ * @folio: The folio.
+ *
+ * A folio is composed of 2^order pages. See get_order() for the definition
+ * of order.
+ *
+ * Return: The order of the folio.
+ */
+static inline unsigned int folio_order(struct folio *folio)
+{
+ return compound_order(&folio->page);
+}
+
#include <linux/huge_mm.h>
/*
@@ -906,27 +927,6 @@ static inline void destroy_compound_page(struct page *page)
compound_page_dtors[page[1].compound_dtor](page);
}
-static inline unsigned int compound_order(struct page *page)
-{
- if (!PageHead(page))
- return 0;
- return page[1].compound_order;
-}
-
-/**
- * folio_order - The allocation order of a folio.
- * @folio: The folio.
- *
- * A folio is composed of 2^order pages. See get_order() for the definition
- * of order.
- *
- * Return: The order of the folio.
- */
-static inline unsigned int folio_order(struct folio *folio)
-{
- return compound_order(&folio->page);
-}
-
static inline bool hpage_pincount_available(struct page *page)
{
/*