lkml.org 
[lkml]   [2013]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH 05/12] mm, thp, tmpfs: request huge page in shm_fault when needed
Date
Ning Qu wrote:
> Add the function to request huge page in shm_fault when needed.
> And it will fall back to regular page if huge page can't be
> satisfied or allocated.
>
> If small page requested but huge page is found, the huge page will
> be splitted.
>
> Signed-off-by: Ning Qu <quning@gmail.com>
> ---
> mm/shmem.c | 32 +++++++++++++++++++++++++++++---
> 1 file changed, 29 insertions(+), 3 deletions(-)
>
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 68a0e1d..2fc450d 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -1472,19 +1472,45 @@ unlock:
> static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
> {
> struct inode *inode = file_inode(vma->vm_file);
> + struct page *page = NULL;
> int error;
> int ret = VM_FAULT_LOCKED;
> gfp_t gfp = mapping_gfp_mask(inode->i_mapping);
> -
> - error = shmem_getpage(inode, vmf->pgoff, &vmf->page, SGP_CACHE, gfp,
> - 0, &ret);
> + bool must_use_thp = vmf->flags & FAULT_FLAG_TRANSHUGE;
> + int flags = 0;
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE_PAGECACHE
> + flags |= AOP_FLAG_TRANSHUGE;
> +#endif

ifdef is not needed: shmem_getpage will ignore AOP_FLAG_TRANSHUGE if
CONFIG_TRANSPARENT_HUGEPAGE_PAGECACHE is not defined.

--
Kirill A. Shutemov


\
 
 \ /
  Last update: 2013-10-15 12:41    [W:0.278 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site