[v2,25/25] mm: Align THP mappings for non-DAX
diff mbox series

Message ID 20200212041845.25879-26-willy@infradead.org
State New
Headers show
Series
  • Large pages in the page cache
Related show

Commit Message

Matthew Wilcox Feb. 12, 2020, 4:18 a.m. UTC
From: William Kucharski <william.kucharski@oracle.com>

When we have the opportunity to use transparent huge pages to map a
file, we want to follow the same rules as DAX.

Signed-off-by: William Kucharski <william.kucharski@oracle.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/huge_memory.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Christoph Hellwig Feb. 12, 2020, 7:50 a.m. UTC | #1
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index b52e007f0856..b8d9e0d76062 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -577,13 +577,10 @@ unsigned long thp_get_unmapped_area(struct file *filp, unsigned long addr,
>  	unsigned long ret;
>  	loff_t off = (loff_t)pgoff << PAGE_SHIFT;
>  
> -	if (!IS_DAX(filp->f_mapping->host) || !IS_ENABLED(CONFIG_FS_DAX_PMD))
> -		goto out;
> -
>  	ret = __thp_get_unmapped_area(filp, addr, len, off, flags, PMD_SIZE);
>  	if (ret)
>  		return ret;
> -out:
> +
>  	return current->mm->get_unmapped_area(filp, addr, len, pgoff, flags);
>  }
>  EXPORT_SYMBOL_GPL(thp_get_unmapped_area);

There is no point in splitting thp_get_unmapped_area and
__thp_get_unmapped_area with this applied (and arguably even before
that).  But we still have ext2 and ext4 that use thp_get_unmapped_area but
only support huge page mappings for DAX, do we need to handle those somehow?

Patch
diff mbox series

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index b52e007f0856..b8d9e0d76062 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -577,13 +577,10 @@  unsigned long thp_get_unmapped_area(struct file *filp, unsigned long addr,
 	unsigned long ret;
 	loff_t off = (loff_t)pgoff << PAGE_SHIFT;
 
-	if (!IS_DAX(filp->f_mapping->host) || !IS_ENABLED(CONFIG_FS_DAX_PMD))
-		goto out;
-
 	ret = __thp_get_unmapped_area(filp, addr, len, off, flags, PMD_SIZE);
 	if (ret)
 		return ret;
-out:
+
 	return current->mm->get_unmapped_area(filp, addr, len, pgoff, flags);
 }
 EXPORT_SYMBOL_GPL(thp_get_unmapped_area);