Received: by 10.192.165.148 with SMTP id m20csp248802imm; Wed, 9 May 2018 12:00:42 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqSbQTOQQZuMPc+tcwlsICV4T2l2gchntIzkttkHJPHQHqfpcKfKbzL0W0xUi7aBGH4ENFl X-Received: by 2002:a63:6108:: with SMTP id v8-v6mr36708790pgb.245.1525892442092; Wed, 09 May 2018 12:00:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525892442; cv=none; d=google.com; s=arc-20160816; b=CJNHILsxOmn5JZasgmuWKRojuKm2POdYoDTBiQZOUbDgogjTESfEq4W580l4ikOgbm 9jdC1o3iWGTEqOo1KyhaU/UCHf3dHsSCb1SkM68oWiVl2QiyDw/CXmX+2LEM4897OcNu arKd1TgzDYE6LNO5gLiXY9LuD064sdZKjaGhq6xVE/4Ql48k+NeryovqYDXblNSVkoEc QZIAZ1cn/BpmxHUMd06DkQ+MhMD33kxCIp/kq3y88gW8cMX+G6kPIbWyqhEEnM4LQci8 WZ35VwXnUr92lCozRjvSjEfYiQtAC94uVAoRk8hxrDW7CnUSr1sK8w/gd3zseOpa8r7Q XRMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=fAo588UllvcubBjP5YkspmAW/29hWWAs9nuDqTT8omA=; b=NutliKZUQdcM4CjWpHbWFfxiJxY+03FGivyGEelGqpeN/9SN6bE7D2j1/KJMbAZ+dm KwFocsiGXdCp/if6F8HoiG/dvwhk5RokygIhl8jWtq+o+3XfIcVWAKCW/J7imdxpSgxL VgxBGpssvB54Z99TohGoDAJlmxoJj5CF1HyyoJLNWqFBN+ogr6WHreAkiqiaZdhBVn7V D0drEOJOMo2SYesDcBfNhxyNluvEamHlrq3GM8AjZjP5ZXKCNv4ZtLio7bHFayrP+Fb2 j0QwOmxm2zVz4Y52L33SZ5+EMwhSXxZ8H6xfOv8lqVD8RNj4ExMyv7sgwn+2YTTvxS3J UipQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=b6Hwnl6I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k10-v6si22297111pgs.304.2018.05.09.12.00.25; Wed, 09 May 2018 12:00:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=b6Hwnl6I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964988AbeEITAN (ORCPT + 99 others); Wed, 9 May 2018 15:00:13 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:44195 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964783AbeEITAM (ORCPT ); Wed, 9 May 2018 15:00:12 -0400 Received: by mail-wr0-f196.google.com with SMTP id y15-v6so24833455wrg.11 for ; Wed, 09 May 2018 12:00:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fAo588UllvcubBjP5YkspmAW/29hWWAs9nuDqTT8omA=; b=b6Hwnl6I8+cxT4i1DkBHtxBwvDT4Gg2HSOc1iih3+9WGB4+1LWY6O4jr9HAyHDMK5b v9yLRCe4QhKzXNIkX8HE0lZSAt4uyarqmAZBctbV4bERJ9cxQWWAjb9XCoag6SYTZBfa GQA9M/lUtL3LjorNn9RwQ9w8B3XGj1drVLQUVaZ+VNFZFBLjHNDpY9fyNFKfb1hZdLvI EZoNm7QTVPJpEebn4QZ7MfMPuOT4CVgiu9shaPXkvlsrdsPLBf35XHgShyxwTEUM3vys 8Msg/0d5cqhTdwuPkwQdmGmXMAelZQdOclU2SgyN+kkcODXkoC096p/ZZZsshDu0ll3v aWhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=fAo588UllvcubBjP5YkspmAW/29hWWAs9nuDqTT8omA=; b=KUJfcNXgPgyQom3DpABUnTWnGUTYjrmuFiPjk1bPJI2X/BmBrS6NlFhYRw76+xc5CW lYpnurQ90Tddy6DNqV1zCf4BbQ7t9WP7Zr+CWWLLvrUnQ5KILX/jPMM9VzEXo06ma7RV /YWNyH+PAUlU0WnlQG4zGlZoQXge81jOcW2mdtWcaGOsFWpgJO76HMPp7jM1H7DZZdBO mvRZTMMdOyU8Suljqmt/Tqmg5Xb3V++dEpXbNjIMPcKM4fv4shAyW2s7mXjmkzqbMm6e f+01IOlM0AUz1IL163VvM/pXjRI9UkTv+wsDxgDentg9Sp8sigUeBlPWHuRgv84HW2Q1 4CPw== X-Gm-Message-State: ALQs6tBf+v8t8z1ZUFBfhGYQrEuYmMMGrE0Gn3/J3021qI7Oy+PueYo4 Usuv1BQc7V8F1hyQuUYlvGk= X-Received: by 2002:adf:ba4a:: with SMTP id t10-v6mr35204655wrg.219.1525892410780; Wed, 09 May 2018 12:00:10 -0700 (PDT) Received: from macbookpro.malat.net (bru31-1-78-225-226-121.fbx.proxad.net. [78.225.226.121]) by smtp.gmail.com with ESMTPSA id a14-v6sm45031522wra.84.2018.05.09.12.00.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 09 May 2018 12:00:09 -0700 (PDT) Received: by macbookpro.malat.net (Postfix, from userid 1000) id CD3B110C04F8; Wed, 9 May 2018 21:00:08 +0200 (CEST) From: Mathieu Malaterre To: Michal Hocko Cc: Mathieu Malaterre , Andrew Morton , Michal Hocko , Vlastimil Babka , Dan Williams , Joonsoo Kim , Pavel Tatashin , Greg Kroah-Hartman , Reza Arbab , Thomas Gleixner , Mel Gorman , Tetsuo Handa , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] =?UTF-8?q?mm:=20move=20function=20=E2=80=98is=5Fpagebl?= =?UTF-8?q?ock=5Fremovable=5Fnolock=E2=80=99=20to=20mm/memory=5Fhotplug.c?= Date: Wed, 9 May 2018 20:59:57 +0200 Message-Id: <20180509190001.24789-1-malat@debian.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180505201107.21070-1-malat@debian.org> References: <20180505201107.21070-1-malat@debian.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Function ‘is_pageblock_removable_nolock’ is not used outside of mm/memory_hotplug.c. Move it next to unique caller: ‘is_mem_section_removable’ and make it static. Remove prototype in . Silence gcc warning (W=1): mm/page_alloc.c:7704:6: warning: no previous prototype for ‘is_pageblock_removable_nolock’ [-Wmissing-prototypes] Suggested-by: Michal Hocko Signed-off-by: Mathieu Malaterre --- v2: this function can be made static, make it so include/linux/memory_hotplug.h | 1 - mm/memory_hotplug.c | 23 +++++++++++++++++++++++ mm/page_alloc.c | 23 ----------------------- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index e0e49b5b1ee1..9566d551a41b 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -107,7 +107,6 @@ static inline bool movable_node_is_enabled(void) } #ifdef CONFIG_MEMORY_HOTREMOVE -extern bool is_pageblock_removable_nolock(struct page *page); extern int arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap); extern int __remove_pages(struct zone *zone, unsigned long start_pfn, diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index f74826cdceea..9342e120518a 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1237,6 +1237,29 @@ static struct page *next_active_pageblock(struct page *page) return page + pageblock_nr_pages; } +static bool is_pageblock_removable_nolock(struct page *page) +{ + struct zone *zone; + unsigned long pfn; + + /* + * We have to be careful here because we are iterating over memory + * sections which are not zone aware so we might end up outside of + * the zone but still within the section. + * We have to take care about the node as well. If the node is offline + * its NODE_DATA will be NULL - see page_zone. + */ + if (!node_online(page_to_nid(page))) + return false; + + zone = page_zone(page); + pfn = page_to_pfn(page); + if (!zone_spans_pfn(zone, pfn)) + return false; + + return !has_unmovable_pages(zone, page, 0, MIGRATE_MOVABLE, true); +} + /* Checks if this range of memory is likely to be hot-removable. */ bool is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages) { diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 905db9d7962f..52731601ca5a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7701,29 +7701,6 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count, return false; } -bool is_pageblock_removable_nolock(struct page *page) -{ - struct zone *zone; - unsigned long pfn; - - /* - * We have to be careful here because we are iterating over memory - * sections which are not zone aware so we might end up outside of - * the zone but still within the section. - * We have to take care about the node as well. If the node is offline - * its NODE_DATA will be NULL - see page_zone. - */ - if (!node_online(page_to_nid(page))) - return false; - - zone = page_zone(page); - pfn = page_to_pfn(page); - if (!zone_spans_pfn(zone, pfn)) - return false; - - return !has_unmovable_pages(zone, page, 0, MIGRATE_MOVABLE, true); -} - #if (defined(CONFIG_MEMORY_ISOLATION) && defined(CONFIG_COMPACTION)) || defined(CONFIG_CMA) static unsigned long pfn_max_align_down(unsigned long pfn) -- 2.11.0