Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2344238ybk; Sun, 17 May 2020 18:24:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRoIsTrzOL/7c6Oxl0XfOcKM/Pidbgo0jyWRkZ1OLzP0bofGMev5xuLg1N/8ltboli6rQS X-Received: by 2002:a17:906:5615:: with SMTP id f21mr12882615ejq.372.1589765065195; Sun, 17 May 2020 18:24:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589765065; cv=none; d=google.com; s=arc-20160816; b=tPV4Zpge/Scz62fV4oF+RjWp/A031I09oZXtFBBT65GXBs25hhbypzH7b/Vv0jj/X7 bZS3aZC60vWZ0rbyBDOmpl3VCgN1CE8UPBylEP2t1FwZUs5FRwohEQfAmc5OQ5IXmJWg 3KsK6zksIaT6xXu3Vg/BSSmkvpS9KDi7Yacv3CmxUDWnEjPK4TN8m/06grJirDFllfHe djIzXQoBhcJFG68JcCN+9TxS9uszqf2PDw2LZ4g/DKEfyVGnFmOiNUeT4dDMM/KZRiWx degSpMKNFnaWzsqo1w+fvl8IV3MdZeAXpHoerhdpSGdinFcfToipezQnNI959UHk4v+Z Jfow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=SdhvkN9n6gLXPp8p9fdMhb+WcIMgtYO8SWbLKHJyjj4=; b=CV8GesexuvHyMHTQte15CTUYmOD/7Vqsahk5utiCO4NiBRe2T5tQPb5nwJc1zLCpSF dM9T4Ip351MT7dJtUn/DKxnHfEAY5zJ97Uopj/GeQqwTlm2I+4R5LB53cZh22rzB6pXX 8gndXCOriINqXr9LIThtOOkdX7jO9/igXZvTBbHe00FgIBfCzRNBNo1PxSNm+mzaUFTz IiImIE2u2k33clXiUo7HZsGgC9httCGgPmErCsZx8p5RJbv9ivV7prGin8lBm6C3BtL2 O6Ci/e7FJQS1yOezsUCqv+BHS4TXyEP1eF2Wt9SqqJe/fp+UPaTgy+NdcTq0oY3cqJTz giaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MuabhevI; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yc25si5564888ejb.373.2020.05.17.18.23.42; Sun, 17 May 2020 18:24:25 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MuabhevI; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726880AbgERBVs (ORCPT + 99 others); Sun, 17 May 2020 21:21:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726665AbgERBVr (ORCPT ); Sun, 17 May 2020 21:21:47 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4FD2C061A0C for ; Sun, 17 May 2020 18:21:46 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id t16so3550526plo.7 for ; Sun, 17 May 2020 18:21:46 -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=SdhvkN9n6gLXPp8p9fdMhb+WcIMgtYO8SWbLKHJyjj4=; b=MuabhevIbTfQchpQvS5cn2iMMKfM/8aBJ3m/YWbNcOt3/i4wK1bg0d9kj3pSzWUOFW xaA023MDC/j7WagLjaLtIL7MK8mub3C3Se23T4C+Z2+Ke15npDeZuBRJa1Il5vBCzZMI T08r5KWO+PDfI5kwN5lpw0VjQpzrRXf6ywfshsZ3lPTVPI7/yYzDFNiGpeys0fD3bec7 pFSy3PJokHLHLpU5dCUFMqgGUeelgDS1fRDGtqCMDiMV13LjHvy9oLCUZJWz6ecwjlqS Yd2hp+W3dFu/dFKabSf3HALmnjDVHJZf8dsVeEwLcObCYEJh8YS7YdwQCLNhiF+WUuuR s/gg== 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=SdhvkN9n6gLXPp8p9fdMhb+WcIMgtYO8SWbLKHJyjj4=; b=lwXZl91N2ex//E7pj2gKVX8bhhL1htTfE+YDxrZ0kqT0gN/GK6HNJ9OWp/nxicMGNQ c5SczD2bl8V2lEvNaRS8mgQrWSEBJPxFMOGrVYwSayXomgUgB0I9UELIke2tNzyzmJ4f Rj0fz/zyoU0ceZfWQIG2030xU12en2acIBpQb6xqaMkd/vO5RCV2Z5fSO6vU7JfSvScV 4VnGBvt/mhXGPN+p/hScG0UMroX9owZoCOQa6OjnSeoCX1mXTOmbJed2C2ST2CjaP4kV VIrs4s+AMbMpafGL8ZTQhroLeb+JAVI/JMwc7axNVmU73O+1Ecn+hwKKgWL+ykmDplI/ cZTg== X-Gm-Message-State: AOAM530oWzP5zLQRpDqw9la9/FBm5tJlpe2LmQBVZ0LKvdDnc/YYXRH8 UfxVGMIBNAJvCscL6xFpsUo= X-Received: by 2002:a17:90a:eacb:: with SMTP id ev11mr16142233pjb.80.1589764906444; Sun, 17 May 2020 18:21:46 -0700 (PDT) Received: from localhost.localdomain ([114.206.198.176]) by smtp.gmail.com with ESMTPSA id fw4sm1544376pjb.31.2020.05.17.18.21.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 May 2020 18:21:46 -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 02/11] mm/migrate: move migration helper from .h to .c Date: Mon, 18 May 2020 10:20:48 +0900 Message-Id: <1589764857-6800-3-git-send-email-iamjoonsoo.kim@lge.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1589764857-6800-1-git-send-email-iamjoonsoo.kim@lge.com> References: <1589764857-6800-1-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 From: Joonsoo Kim It's not performance sensitive function. Move it to .c. This is a preparation step for future change. 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 5fed030..a298a8c 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1519,6 +1519,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