mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-31 16:38:12 +00:00
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>
This commit is contained in:
parent
821979f509
commit
5bf34d7c7f
2 changed files with 35 additions and 21 deletions
|
@ -274,6 +274,15 @@ static inline int thp_nr_pages(struct page *page)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* folio_test_pmd_mappable - Can we map this folio with a PMD?
|
||||
* @folio: The folio to test
|
||||
*/
|
||||
static inline bool folio_test_pmd_mappable(struct folio *folio)
|
||||
{
|
||||
return folio_order(folio) >= HPAGE_PMD_ORDER;
|
||||
}
|
||||
|
||||
struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr,
|
||||
pmd_t *pmd, int flags, struct dev_pagemap **pgmap);
|
||||
struct page *follow_devmap_pud(struct vm_area_struct *vma, unsigned long addr,
|
||||
|
@ -339,6 +348,11 @@ static inline int thp_nr_pages(struct page *page)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static inline bool folio_test_pmd_mappable(struct folio *folio)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma)
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue