From patchwork Tue Jun 23 06:13:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonsoo Kim X-Patchwork-Id: 11619823 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7E28A6C1 for ; Tue, 23 Jun 2020 06:14:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 41ECA20772 for ; Tue, 23 Jun 2020 06:14:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="vJdc2Dds" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 41ECA20772 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 70B2B6B0006; Tue, 23 Jun 2020 02:14:33 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6EBF56B0007; Tue, 23 Jun 2020 02:14:33 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F86B6B0008; Tue, 23 Jun 2020 02:14:33 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0032.hostedemail.com [216.40.44.32]) by kanga.kvack.org (Postfix) with ESMTP id 4A85F6B0006 for ; Tue, 23 Jun 2020 02:14:33 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0F712180AD82F for ; Tue, 23 Jun 2020 06:14:33 +0000 (UTC) X-FDA: 76959462426.22.cave37_490f40226e39 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id DA50C18038E60 for ; Tue, 23 Jun 2020 06:14:32 +0000 (UTC) X-Spam-Summary: 2,0,0,93380cba6ab07005,d41d8cd98f00b204,js1304@gmail.com,,RULES_HIT:41:69:355:379:541:800:960:966:973:988:989:1260:1345:1359:1437:1535:1543:1711:1730:1747:1777:1792:2196:2198:2199:2200:2393:2559:2562:2731:3138:3139:3140:3141:3142:3355:3867:3870:3871:3872:4117:4385:4605:5007:6117:6261:6653:7576:7903:8957:9413:9592:10004:11026:11473:11658:11914:12043:12291:12296:12297:12438:12517:12519:12555:12679:12683:12895:13149:13230:14096:14110:14181:14394:14721:21080:21444:21451:21627:21666:21990:30046:30051:30054:30064:30070,0,RBL:209.85.215.196:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: cave37_490f40226e39 X-Filterd-Recvd-Size: 6857 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Tue, 23 Jun 2020 06:14:32 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id z5so905984pgb.6 for ; Mon, 22 Jun 2020 23:14:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+MVtWxNOjft+jnGBXpp4pllO9Ogv4crRgAM5bysUzc4=; b=vJdc2DdsINl4/duViwymAa2D/kIoWhki7coFXXsCJJ/saKbX3fjWfBe+ncAeJT/iEF joiD9mYpK1OxlPN5G3lrkNXEwY69XOkf6CpxNLD2W8cKodX6CmN/krlcq5WBd2U2hr7l ADmF5eBwGoqNB1DTHnA8g7uSeMPNYWD2mnKtuDL+5pLD1LrWYBW8pW3SF6oPxAzMmmyE cwsC/cLfoBN/CZKMLzVmSWYQ/74kyg/YY3MX8ozzeDxIFkkhhQ4pEDdDiA+Z9RhAMj6i 5R7c/FbCx8+F38QkX2+1lQFgFNMhg6fR34RrDexlw/mxbxIVDnk1umcTaaBoeJ4Yq8x6 V6mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+MVtWxNOjft+jnGBXpp4pllO9Ogv4crRgAM5bysUzc4=; b=R8dsVWS745bdBzoUGluDNwdokxZNJYtLJeaO8CLp2Ay12hapz9KZA3XBbeXdAeUQpe 5mbdR48W7cQoB1W5nPHp2bm6IUvFUseS+Gc2zNDKfTIBKuc2+g9fFe69jXhKZh0o/tif SPDkLoqmmvrP4+iUL3oOAKWNn1c1AOzErF2GuL6WzrD+nHY/GjrQuN/hSuKafiiFNJrX Qj39QbxlBuFLm4mAgXTh7+lcn/F5fG8ePurKNeagJUkU7vHbyf8JqJTj8li35+Vv+6nK GidoN9/xYBSUJvh8ANauPgNFFRUSX1CHHMzI/U/MCl5O7gkdQDqp5AtephGjYZ9FOhFC wT8w== X-Gm-Message-State: AOAM533F4SI+VhvSgVrgI+5Z/4yepX6eBzlEvpuHiv44w/bU2A8jWXl4 NvCcf2WEkTpWvTsZ6mU7/lo= X-Google-Smtp-Source: ABdhPJxvGPPxCMlACeH3Qo4G5gtuVjR48+Qt5rn3qikPJKHVLEIXNh/BCaT2G+RN58qcSRYI0gyW+A== X-Received: by 2002:a63:af50:: with SMTP id s16mr16564252pgo.365.1592892871363; Mon, 22 Jun 2020 23:14:31 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id m15sm12801093pgv.45.2020.06.22.23.14.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jun 2020 23:14:30 -0700 (PDT) From: js1304@gmail.com X-Google-Original-From: iamjoonsoo.kim@lge.com To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@lge.com, Vlastimil Babka , Christoph Hellwig , Roman Gushchin , Mike Kravetz , Naoya Horiguchi , Michal Hocko , Joonsoo Kim Subject: [PATCH v3 2/8] mm/migrate: move migration helper from .h to .c Date: Tue, 23 Jun 2020 15:13:42 +0900 Message-Id: <1592892828-1934-3-git-send-email-iamjoonsoo.kim@lge.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1592892828-1934-1-git-send-email-iamjoonsoo.kim@lge.com> References: <1592892828-1934-1-git-send-email-iamjoonsoo.kim@lge.com> X-Rspamd-Queue-Id: DA50C18038E60 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 Acked-by: Michal Hocko Reviewed-by: Vlastimil Babka Signed-off-by: Joonsoo Kim --- 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 c95912f..6b5c75b 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1536,6 +1536,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)