From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932304Ab3JOKhw (ORCPT ); Tue, 15 Oct 2013 06:37:52 -0400 Received: from mga14.intel.com ([143.182.124.37]:59709 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932247Ab3JOKhv (ORCPT ); Tue, 15 Oct 2013 06:37:51 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,498,1378882800"; d="scan'208";a="374914715" From: "Kirill A. Shutemov" To: Ning Qu Cc: Andrea Arcangeli , Andrew Morton , "Kirill A. Shutemov" , Hugh Dickins , Al Viro , Hugh Dickins , Wu Fengguang , Jan Kara , Mel Gorman , linux-mm@kvack.org, Andi Kleen , Matthew Wilcox , Hillf Danton , Dave Hansen , Alexander Shishkin , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Ning Qu In-Reply-To: <20131015001242.GF3432@hippobay.mtv.corp.google.com> References: <20131015001242.GF3432@hippobay.mtv.corp.google.com> Subject: RE: [PATCH 05/12] mm, thp, tmpfs: request huge page in shm_fault when needed Content-Transfer-Encoding: 7bit Message-Id: <20131015103744.A0BD3E0090@blue.fi.intel.com> Date: Tue, 15 Oct 2013 13:37:44 +0300 (EEST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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