Received: by 10.192.165.148 with SMTP id m20csp858298imm; Thu, 10 May 2018 01:36:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrWyLalVBhum8u9MD/1ezTcJB6O9eROF60vgn2pimBcObV13pPPSOl/GrEoP6XEOQ+RpbyY X-Received: by 2002:a17:902:b94c:: with SMTP id h12-v6mr516009pls.322.1525941410450; Thu, 10 May 2018 01:36:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525941410; cv=none; d=google.com; s=arc-20160816; b=XsvyEvK+kljWaLuB6DvaO1fDB6RZeGl8KQzhuLTD0lv7PMjiChDPovNn0x4CyH2tgy /jrepwrrEsTi+NGG6L1ZsivPXz8e72VMzsCGJAsPVY9T4FZ3xtpT/JkMczT0b0KpGAHG ZA2NS4BlzoqfC8tvpgyohVRWdkrZokZWHzQy5NLj59do6mNH5RRTFgx9IRIhcmhjM3eg VgQnWQerFWcz1wWE3qLZM42VWMancKg6mwKdTP/i5498+O+fQsou86d6id5g3k/PqNc4 jMozUuYZSgcacqfdZYee98RVXFscTTWAGBUVkx7PS5zMkEsraHvhjKNLsAqrszfWLNbx BTJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=Lej+TvnSHElBpYUkYnZNoKj5ZYb4Qj8g+MpvvG/qLB4=; b=penR1bxhlf6XkJQMWgp456VThYIPgiCRfgBNHeQZbWN42z/40RmvQ3B1mzfStk+R03 RlrSm3eQR/tF/yMk6FslfwfvpyGstMplUCw653nWtSEEo8DOFOzeeGj72jfNFj0UrXKP ml208aHSr9vBlZx5r6Z9wmvP2zPM9NSSk8J9bbasSSAeX9Z+Pqbm8h58+noreF+VGP6N Jy7AkIMGgi/kJ2dUX9lPHRBGmSyMuV5wVY8oUkqT9ur9a0dzTfs0I0W0p16BOo1kvakt /RhrH3+9+Oj6IyOt/2rmT7F6siUyTUHP+89pGpHeKdsYNNRjQm+cQfgI4ORAwD3tJO1Y Qbsw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 68-v6si255065pla.531.2018.05.10.01.36.36; Thu, 10 May 2018 01:36:50 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934783AbeEJIgK (ORCPT + 99 others); Thu, 10 May 2018 04:36:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:54105 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934366AbeEJIgI (ORCPT ); Thu, 10 May 2018 04:36:08 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9A58DAD98; Thu, 10 May 2018 08:36:06 +0000 (UTC) Date: Thu, 10 May 2018 10:36:04 +0200 From: Michal Hocko To: Mathieu Malaterre Cc: Andrew Morton , 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: Re: [PATCH v2] mm: move =?utf-8?Q?function?= =?utf-8?B?IOKAmGlzX3BhZ2VibG9ja19yZW1vdmFibGVfbm9sb2Nr?= =?utf-8?B?4oCZ?= to mm/memory_hotplug.c Message-ID: <20180510083604.GI32366@dhcp22.suse.cz> References: <20180505201107.21070-1-malat@debian.org> <20180509190001.24789-1-malat@debian.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180509190001.24789-1-malat@debian.org> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 09-05-18 20:59:57, Mathieu Malaterre wrote: > 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 Acked-by: Michal Hocko Thanks! > --- > 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 > -- Michal Hocko SUSE Labs