Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp485181ybg; Tue, 9 Jun 2020 05:53:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz7ypuEPMhDFA/1SEcQTH2DnVzL8969xKZ0YhLaGz07KQi9YLzRo3nMBRZidkVRi6EpfgR X-Received: by 2002:a50:9517:: with SMTP id u23mr26243384eda.332.1591707229548; Tue, 09 Jun 2020 05:53:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591707229; cv=none; d=google.com; s=arc-20160816; b=CqZFZaOm8la7LLsJg0euaUt3ZJrux63yQWqNHWlg2HyTPVnCnwKS0ourlM95w53tmP mW7XF1ktOA6zrgyvpF6FnU8fK4+WlXrEOMoMnpeFU61gh33f3/fz0fgTC2BIhYFx2xUa 1KRyvY2ym7vKIC7iCTAzYyhGX9Jy1q0hpc1PFC+wLe1C9lNFxjMh2EZxfkoneTd2pSha HlgOVzHsMa6i2n2TK+jCGAnaQA0ppLNVW51tBjfUK6AiNd7rM3msoMChqLtPp4X6tTQs bFold/HF+Lv27OiG8NE8kwyKU6hF+DbEUrSTu9X82IAQ0eHee2Z+8spYiEXnnis72iCS oJsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=bUQBLKaV0rY++J1kBEYJ4YPNIo1mi5EzugMLZWIn43Q=; b=jJe0PHUn+2HJOXBbP0FPbs3Z7WxNb2C5Aik6Jm8jD4V6Zr0GUglOOuEgJz7mypgDGF SKHrcr/Wyhgh/a0IXkCqQNFYXi53l1SKId/ZkiTuolbnZtludH5Z8LtP+BNVtMZDXnvZ hKYf9DkSOSFizS3NE0UD2flFe90C/7KgOsrlKjfhmsDlo56oPlgTq9EQLm+dTKdeKfuw G3yQ+kgQBdUEWL5gFrZHYYysbrT562/3DHZuM5m7A30uXNaGsVaom2M5izV7BZxmQ/9m LF3GjSb+KyTnXdKUso/1SQ23IZvHMeOpIdBBQ0j25va/EOCabnwbGuETLttZqUyU9UAq FnNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z2si12265133edp.280.2020.06.09.05.53.26; Tue, 09 Jun 2020 05:53:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729351AbgFIMoe (ORCPT + 99 others); Tue, 9 Jun 2020 08:44:34 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:56264 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727773AbgFIMoe (ORCPT ); Tue, 9 Jun 2020 08:44:34 -0400 Received: by mail-wm1-f65.google.com with SMTP id c71so2684680wmd.5 for ; Tue, 09 Jun 2020 05:44:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=bUQBLKaV0rY++J1kBEYJ4YPNIo1mi5EzugMLZWIn43Q=; b=alISAaXqI7zWCQulHuU/hcwu27KfeHc7JphQyXybpXCaZMkv7yA06SRq5m4Q3GlU2g vu4iq1J9WTjAchER+xTNCK7+s6OLeZcf1otRZwjVA3SdA6vDb7Sy2tmytWCdloa83TWz 9Gip8X727whYLac6dbFo2Uld7FO53S9slHgWRQacvJhO1vpjqEqQdEeMWZzT4CiQqWZG XvsPnbf5EdsjCeG/57wIXwzfMBiMRKbAiMP/jZdME+IdMsbQR1q7QxZ1Ud8zAPOlpNoq nMbXZHCjb0KYMRO45lRBeowchHsyvOT/ggMEN1/jBLW+3MS5wCD4LJXDAN4XKMLSKBYc CCCw== X-Gm-Message-State: AOAM531YV11aI+6cnljv2286M7eJ0y5N2zttKc/99O57bUkvi5AaPUQr i8Xzgzho12Uj7pQjLAQHy/I= X-Received: by 2002:a7b:c8d6:: with SMTP id f22mr3722092wml.108.1591706672380; Tue, 09 Jun 2020 05:44:32 -0700 (PDT) Received: from localhost (ip-37-188-174-195.eurotel.cz. [37.188.174.195]) by smtp.gmail.com with ESMTPSA id p16sm3438105wru.27.2020.06.09.05.44.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 05:44:31 -0700 (PDT) Date: Tue, 9 Jun 2020 14:44:30 +0200 From: Michal Hocko To: js1304@gmail.com Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@lge.com, Vlastimil Babka , Christoph Hellwig , Roman Gushchin , Mike Kravetz , Naoya Horiguchi , Joonsoo Kim Subject: Re: [PATCH v2 02/12] mm/migrate: move migration helper from .h to .c Message-ID: <20200609124430.GD22623@dhcp22.suse.cz> References: <1590561903-13186-1-git-send-email-iamjoonsoo.kim@lge.com> <1590561903-13186-3-git-send-email-iamjoonsoo.kim@lge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1590561903-13186-3-git-send-email-iamjoonsoo.kim@lge.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 27-05-20 15:44:53, Joonsoo Kim wrote: > From: Joonsoo Kim > > It's not performance sensitive function. Move it to .c. > This is a preparation step for future change. > > Acked-by: Mike Kravetz > Signed-off-by: Joonsoo Kim Acked-by: Michal Hocko > --- > include/linux/migrate.h | 33 +++++---------------------------- > mm/migrate.c | 29 +++++++++++++++++++++++++++++ > 2 files changed, 34 insertions(+), 28 deletions(-) > > diff --git a/include/linux/migrate.h b/include/linux/migrate.h > index 3e546cb..1d70b4a 100644 > --- a/include/linux/migrate.h > +++ b/include/linux/migrate.h > @@ -31,34 +31,6 @@ enum migrate_reason { > /* In mm/debug.c; also keep sync with include/trace/events/migrate.h */ > extern const char *migrate_reason_names[MR_TYPES]; > > -static inline struct page *new_page_nodemask(struct page *page, > - int preferred_nid, nodemask_t *nodemask) > -{ > - gfp_t gfp_mask = GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL; > - unsigned int order = 0; > - struct page *new_page = NULL; > - > - if (PageHuge(page)) > - return alloc_huge_page_nodemask(page_hstate(compound_head(page)), > - preferred_nid, nodemask); > - > - if (PageTransHuge(page)) { > - gfp_mask |= GFP_TRANSHUGE; > - order = HPAGE_PMD_ORDER; > - } > - > - if (PageHighMem(page) || (zone_idx(page_zone(page)) == ZONE_MOVABLE)) > - gfp_mask |= __GFP_HIGHMEM; > - > - new_page = __alloc_pages_nodemask(gfp_mask, order, > - preferred_nid, nodemask); > - > - if (new_page && PageTransHuge(new_page)) > - prep_transhuge_page(new_page); > - > - return new_page; > -} > - > #ifdef CONFIG_MIGRATION > > extern void putback_movable_pages(struct list_head *l); > @@ -67,6 +39,8 @@ extern int migrate_page(struct address_space *mapping, > enum migrate_mode mode); > extern int migrate_pages(struct list_head *l, new_page_t new, free_page_t free, > unsigned long private, enum migrate_mode mode, int reason); > +extern struct page *new_page_nodemask(struct page *page, > + int preferred_nid, nodemask_t *nodemask); > extern int isolate_movable_page(struct page *page, isolate_mode_t mode); > extern void putback_movable_page(struct page *page); > > @@ -85,6 +59,9 @@ static inline int migrate_pages(struct list_head *l, new_page_t new, > free_page_t free, unsigned long private, enum migrate_mode mode, > int reason) > { return -ENOSYS; } > +static inline struct page *new_page_nodemask(struct page *page, > + int preferred_nid, nodemask_t *nodemask) > + { return NULL; } > static inline int isolate_movable_page(struct page *page, isolate_mode_t mode) > { return -EBUSY; } > > diff --git a/mm/migrate.c b/mm/migrate.c > index 22a26a5..824c22e 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1537,6 +1537,35 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page, > return rc; > } > > +struct page *new_page_nodemask(struct page *page, > + int preferred_nid, nodemask_t *nodemask) > +{ > + gfp_t gfp_mask = GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL; > + unsigned int order = 0; > + struct page *new_page = NULL; > + > + if (PageHuge(page)) > + return alloc_huge_page_nodemask( > + page_hstate(compound_head(page)), > + preferred_nid, nodemask); > + > + if (PageTransHuge(page)) { > + gfp_mask |= GFP_TRANSHUGE; > + order = HPAGE_PMD_ORDER; > + } > + > + if (PageHighMem(page) || (zone_idx(page_zone(page)) == ZONE_MOVABLE)) > + gfp_mask |= __GFP_HIGHMEM; > + > + new_page = __alloc_pages_nodemask(gfp_mask, order, > + preferred_nid, nodemask); > + > + if (new_page && PageTransHuge(new_page)) > + prep_transhuge_page(new_page); > + > + return new_page; > +} > + > #ifdef CONFIG_NUMA > > static int store_status(int __user *status, int start, int value, int nr) > -- > 2.7.4 > -- Michal Hocko SUSE Labs