From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751951AbdKTRHT (ORCPT ); Mon, 20 Nov 2017 12:07:19 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59996 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751611AbdKTRHR (ORCPT ); Mon, 20 Nov 2017 12:07:17 -0500 Date: Mon, 20 Nov 2017 17:07:09 +0000 From: Andrea Reale To: Zi Yan Cc: linux-kernel@vger.kernel.org, n-horiguchi@ah.jp.nec.com, akpm@linux-foundation.org, jglisse@redhat.com, realean2@ie.ibm.com Subject: Re: [PATCH 1/1] mm/migrate: do not call prep_transhuge_page if !thp_migration_supported References: <2eebd2959214f4dc2b2e9fa7f1059208c6650e8c.1511193197.git.ar@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 17112017-0020-0000-0000-000003CE8A0D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17112017-0021-0000-0000-00004263D251 Message-Id: <20171120170708.GB6912@samekh> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-20_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1711200229 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Yan Zi, thanks for the feedback. Yes, it looks definitely less redundant :) Regards, Andrea On Mon, Nov 20, 2017 at 11:33:06AM -0500, Zi Yan wrote: > Hi Andrea, > > Thanks for pointing this out. > > I think the problem is that we should not prep_transhuge_page(new_page) > unless new_page is allocated and PageTransHuge(). And several lines above, > the allocation flags and the order is changed to make new_page a THP > only if thp_migration_supported() is true. > > Does the patch below look better? > > diff --git a/include/linux/migrate.h b/include/linux/migrate.h > index 895ec0c..725eac5 100644 > --- a/include/linux/migrate.h > +++ b/include/linux/migrate.h > @@ -54,7 +54,7 @@ static inline struct page *new_page_nodemask(struct page *page, > new_page = __alloc_pages_nodemask(gfp_mask, order, > preferred_nid, nodemask); > > - if (new_page && PageTransHuge(page)) > + if (new_page && PageTransHuge(new_page)) > prep_transhuge_page(new_page); > > return new_page; > -- > > > -- > Best Regards > Yan Zi > > On 20 Nov 2017, at 11:17, Andrea Reale wrote: > > > new_page_nodemask in linux/migrate.h should not call prep_transhuge_page > > if thp_migration_support is false. > > > > Fixes commit 8135d8926c08 ("mm: memory_hotplug: memory hotremove supports > > thp migration") > > > > Signed-off-by: Andrea Reale > > --- > > include/linux/migrate.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/include/linux/migrate.h b/include/linux/migrate.h > > index 895ec0c..725eac5 100644 > > --- a/include/linux/migrate.h > > +++ b/include/linux/migrate.h > > @@ -54,7 +54,7 @@ static inline struct page *new_page_nodemask(struct page *page, > > new_page = __alloc_pages_nodemask(gfp_mask, order, > > preferred_nid, nodemask); > > > > - if (new_page && PageTransHuge(page)) > > + if (thp_migration_supported() && new_page && PageTransHuge(page)) > > prep_transhuge_page(new_page); > > > > return new_page; > > -- > > 2.7.4