Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3346213ybt; Mon, 22 Jun 2020 23:16:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxU5/YPqYtmZAnsls1AkDZy4WY3I7BUzKQYbtnLKzrf89g8uZZ81UOJDBkt7hPgin28qr6z X-Received: by 2002:a17:906:9382:: with SMTP id l2mr19515636ejx.8.1592893005226; Mon, 22 Jun 2020 23:16:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592893005; cv=none; d=google.com; s=arc-20160816; b=tqUNW9/XZiqlBqN27ONPHjIu4RHP7jeKBm5obMUpFopxsu1SZwecoLnrA1eWyC/PQH zmP4qTb2xvZoaNCjm/moAVtJ5PvfyJfTqQ04J7sIPmtn/rAvihmWlltGhRqA6G6o6hHH SLbivMsusXVRiVekwsu4/vB1R9MuktRAuXekph1WCySWpAMF3QlTVhoJlRHV78R56M63 9WeBkfGYxTDy2cpKNyFES5OMcVNANo1b8VJ4L+SEwbJIC/HOOzoZSfFyE5diLXP/boHX TyJ7kgviW2ck62CXG0z8iAD7lyUv7SEY9oD0755p87UQbiYHEl3yBIrJ2ZX3yJWP1UWM gIrQ== 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=+MVtWxNOjft+jnGBXpp4pllO9Ogv4crRgAM5bysUzc4=; b=TfHon/ye2lJel+C2L0bZ++qh8ZtA1U5LdblCPg56OYOEXCq2Dj0UJvT4onepBklYLd tNGn8GPAEWD9fqF5BJC06B07vo2MYWV13RdJFlSo4jIFi782oA7cd8gRG2NhFVSeMCGl MaTE4skOZ45nnteTlD7THkoDd83uRnj1EA8TzaOrP08nrqHBTrc9LdQHc17Ub2ZyVcDq JOGh+kh/NgNdD+1gQ8yii5pNk77wKJpbipFlZW0W24mb1UwRhwC6Kd0/+haKGRM4tH05 13VnQ1tEkEoh9PoAzagddMmPvoC5AADFevLxt/ues6efVJifjPTqeBUUVj5bIGg0uK1h i+8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vJdc2Dds; 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 u22si10735770eds.253.2020.06.22.23.16.22; Mon, 22 Jun 2020 23:16:45 -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=vJdc2Dds; 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 S1730843AbgFWGOe (ORCPT + 99 others); Tue, 23 Jun 2020 02:14:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730571AbgFWGOd (ORCPT ); Tue, 23 Jun 2020 02:14:33 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4173C061573 for ; Mon, 22 Jun 2020 23:14:31 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id d66so9599190pfd.6 for ; Mon, 22 Jun 2020 23:14:31 -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=KtPAbKY8ZXfl7nDuAREeSJPhQXvirjvCBe3Ki44K3ocHFzHEAIWZC63WKVz8vEf4T1 wDcHqp7fBXfzOJXr/UvwFu4e4M2tcvAZ5565mItsXMems+12lYZ+iM7eQ6qHVAE/TFaR X948Ftc3uJhwe5lsdicQS72bD8VJqcZcIhAIMX7nDN0fn0PGP0Z2cbIMLwRJNxo4BGFo x3l+OuaaGq6fPndYmO4QZZJRvxCu66qIKxyPxSRlS2KWSoAvn/cqs6HooB1SykPUyK56 SkAeKPb7rmzph4fooyvlcPQmukQ7jgtLZt5Y0Ad0RvU4EPzYjlhnQku1K2s7L3LC9gHL wHvg== X-Gm-Message-State: AOAM530CmKIQxXtnFEgH8egdIohRE/Kf9NOMtYZhvLmsDqPvitiCYGAE 2v5dZMOlQN4HScziG1GiXP0= 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> 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. 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) -- 2.7.4