Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751364AbdFZFib (ORCPT ); Mon, 26 Jun 2017 01:38:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:60409 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750914AbdFZFiY (ORCPT ); Mon, 26 Jun 2017 01:38:24 -0400 Date: Mon, 26 Jun 2017 07:38:19 +0200 From: Michal Hocko To: Wei Yang Cc: Andrew Morton , linux-mm@kvack.org, Mel Gorman , Vlastimil Babka , Andrea Arcangeli , Jerome Glisse , Reza Arbab , Yasuaki Ishimatsu , qiuxishi@huawei.com, Kani Toshimitsu , slaoub@gmail.com, Joonsoo Kim , Andi Kleen , David Rientjes , Daniel Kiper , Igor Mammedov , Vitaly Kuznetsov , LKML , Dan Williams , Heiko Carstens , Martin Schwidefsky Subject: Re: [PATCH 11/14] mm, memory_hotplug: do not associate hotadded memory to zones until online Message-ID: <20170626053819.GB31972@dhcp22.suse.cz> References: <20170515085827.16474-1-mhocko@kernel.org> <20170515085827.16474-12-mhocko@kernel.org> <20170625001413.GA43522@WeideMacBook-Pro.local> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170625001413.GA43522@WeideMacBook-Pro.local> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1923 Lines: 62 On Sun 25-06-17 08:14:13, Wei Yang wrote: > On Mon, May 15, 2017 at 10:58:24AM +0200, Michal Hocko wrote: > >From: Michal Hocko > > > [...] > >+void move_pfn_range_to_zone(struct zone *zone, > >+ unsigned long start_pfn, unsigned long nr_pages) > >+{ > >+ struct pglist_data *pgdat = zone->zone_pgdat; > >+ int nid = pgdat->node_id; > >+ unsigned long flags; > >+ unsigned long i; > > This is an unused variable: > > mm/memory_hotplug.c: In function ‘move_pfn_range_to_zone’: > mm/memory_hotplug.c:895:16: warning: unused variable ‘i’ [-Wunused-variable] > > Do you suggest me to write a patch or you would fix it in your later rework? Please send a fix for your http://lkml.kernel.org/r/20170616092335.5177-2-richard.weiyang@gmail.com Andrew will fold it into that patch. > > >+ > >+ if (zone_is_empty(zone)) > >+ init_currently_empty_zone(zone, start_pfn, nr_pages); > >+ > >+ clear_zone_contiguous(zone); > >+ > >+ /* TODO Huh pgdat is irqsave while zone is not. It used to be like that before */ > >+ pgdat_resize_lock(pgdat, &flags); > >+ zone_span_writelock(zone); > >+ resize_zone_range(zone, start_pfn, nr_pages); > >+ zone_span_writeunlock(zone); > >+ resize_pgdat_range(pgdat, start_pfn, nr_pages); > >+ pgdat_resize_unlock(pgdat, &flags); > >+ > >+ /* > >+ * TODO now we have a visible range of pages which are not associated > >+ * with their zone properly. Not nice but set_pfnblock_flags_mask > >+ * expects the zone spans the pfn range. All the pages in the range > >+ * are reserved so nobody should be touching them so we should be safe > >+ */ > >+ memmap_init_zone(nr_pages, nid, zone_idx(zone), start_pfn, MEMMAP_HOTPLUG); > >+ for (i = 0; i < nr_pages; i++) { > >+ unsigned long pfn = start_pfn + i; > >+ set_page_links(pfn_to_page(pfn), zone_idx(zone), nid, pfn); > > } > > > >2.11.0 > > -- > Wei Yang > Help you, Help me -- Michal Hocko SUSE Labs