Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1036611AbdDUIYc (ORCPT ); Fri, 21 Apr 2017 04:24:32 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:41809 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1033649AbdDUIXI (ORCPT ); Fri, 21 Apr 2017 04:23:08 -0400 Subject: Re: [PATCH v5 09/11] mm: mempolicy: mbind and migrate_pages support thp migration To: Zi Yan , n-horiguchi@ah.jp.nec.com, kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20170420204752.79703-1-zi.yan@sent.com> <20170420204752.79703-10-zi.yan@sent.com> Cc: akpm@linux-foundation.org, minchan@kernel.org, vbabka@suse.cz, mgorman@techsingularity.net, mhocko@kernel.org, khandual@linux.vnet.ibm.com, zi.yan@cs.rutgers.edu, dnellans@nvidia.com From: Anshuman Khandual Date: Fri, 21 Apr 2017 13:52:00 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170420204752.79703-10-zi.yan@sent.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable x-cbid: 17042108-0008-0000-0000-00000121E123 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17042108-0009-0000-0000-0000094F318E Message-Id: <1ebd80d1-7bb1-db6d-a60c-7f4b7b6afe0f@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-04-21_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1704210154 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1743 Lines: 53 On 04/21/2017 02:17 AM, Zi Yan wrote: > From: Naoya Horiguchi > > This patch enables thp migration for mbind(2) and migrate_pages(2). > > Signed-off-by: Naoya Horiguchi > --- > ChangeLog v1 -> v2: > - support pte-mapped and doubly-mapped thp > --- > mm/mempolicy.c | 108 +++++++++++++++++++++++++++++++++++++++++---------------- > 1 file changed, 79 insertions(+), 29 deletions(-) Snip > @@ -981,7 +1012,17 @@ static struct page *new_node_page(struct page *page, unsigned long node, int **x > if (PageHuge(page)) > return alloc_huge_page_node(page_hstate(compound_head(page)), > node); > - else > + else if (thp_migration_supported() && PageTransHuge(page)) { > + struct page *thp; > + > + thp = alloc_pages_node(node, > + (GFP_TRANSHUGE | __GFP_THISNODE) & ~__GFP_RECLAIM, > + HPAGE_PMD_ORDER); > + if (!thp) > + return NULL; > + prep_transhuge_page(thp); > + return thp; > + } else > return __alloc_pages_node(node, GFP_HIGHUSER_MOVABLE | > __GFP_THISNODE, 0); > } > @@ -1147,6 +1188,15 @@ static struct page *new_page(struct page *page, unsigned long start, int **x) > if (PageHuge(page)) { > BUG_ON(!vma); > return alloc_huge_page_noerr(vma, address, 1); > + } else if (thp_migration_supported() && PageTransHuge(page)) { > + struct page *thp; > + > + thp = alloc_hugepage_vma(GFP_TRANSHUGE, vma, address, > + HPAGE_PMD_ORDER); > + if (!thp) > + return NULL; > + prep_transhuge_page(thp); > + return thp; GFP flags in both these new page allocation functions should be the same. Does alloc_hugepage_vma() will eventually call page allocation with the following flags. (GFP_TRANSHUGE | __GFP_THISNODE) & ~__GFP_RECLAIM