Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753282AbdFPJLY (ORCPT ); Fri, 16 Jun 2017 05:11:24 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36416 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753035AbdFPJLW (ORCPT ); Fri, 16 Jun 2017 05:11:22 -0400 Date: Fri, 16 Jun 2017 17:11:17 +0800 From: Wei Yang To: Michal Hocko Cc: Wei Yang , 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: <20170616091117.GA4716@WeideMacBook-Pro.local> Reply-To: Wei Yang References: <20170515085827.16474-1-mhocko@kernel.org> <20170515085827.16474-12-mhocko@kernel.org> <20170616081142.GA3871@WeideMacBook-Pro.local> <20170616084555.GD30580@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="MGYHOYXEY6WxJCY8" Content-Disposition: inline In-Reply-To: <20170616084555.GD30580@dhcp22.suse.cz> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3190 Lines: 94 --MGYHOYXEY6WxJCY8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 16, 2017 at 10:45:55AM +0200, Michal Hocko wrote: >On Fri 16-06-17 16:11:42, Wei Yang wrote: >> Well, I love this patch a lot. We don't need to put the hotadd memory in= one >> zone and move it to another. This looks great! >>=20 >> 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 =3D zone->zone_pgdat; >> >+ int nid =3D pgdat->node_id; >> >+ unsigned long flags; >> >+ unsigned long i; >> >+ >> >+ 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 th= at 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_HOT= PLUG); >> >+ for (i =3D 0; i < nr_pages; i++) { >> >+ unsigned long pfn =3D start_pfn + i; >> >+ set_page_links(pfn_to_page(pfn), zone_idx(zone), nid, pfn); >> > } >>=20 >> memmap_init_zone()->__init_single_page()->set_page_links() >>=20 >> Do I miss something that you call set_page_links() explicitly here? > >I guess you are right. Not sure why I've done this explicitly. I've most >probably just missed that. Could you post a patch that removes the for >loop. > Sure, I will come up with two patches based on you auto-latest branch. >Thanks! >--=20 >Michal Hocko >SUSE Labs --=20 Wei Yang Help you, Help me --MGYHOYXEY6WxJCY8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJZQ6C1AAoJEKcLNpZP5cTdbqEP/AuOPq0IA6aw7Pd1Kb75o6c/ 9SRvNz7dlG7/9+wOs1QIN/3xxl+rDn0rbFOHXztZLkVATQwQfkTw4F2pfUhRUieS AF3v9fHfzRCWgEi5gyyOA7wWNWyvegr2CU0KuWoKlABiBdJiGHjJEESJ2TEMOz0t +2oMTMBw1PzStNL7ZM0UM+MflduHJSzQ7j+xT3RliyhDvGxouHcz5VBjLxiefsbw 0kqesAD8XPUMu/nXsZOrcDfYCSiFi9SmpCUSUdoiRo9lR+5LSZ9lI5GMxTfySfOO /X2Eek64H0trR/B9F/7cbNMj67yD+8q1AVk5+lyKsPJF0fVNV9zxLO2lEbAb/2ho YoJ5OyIaxVjsH+bfvyZhoJNMT4/wkw+5Li6NjHPVyAQ9vb7pgHgJysSwYfnGuHE3 Z+y9gKNqwxxtCieSfmxhbXgR93Zj7EvvDhRth4JZpf1Kv5yK6a5wRtkZsBky330z 1RTFwO0FtCmuvQCLm4pxBnSN+U34DJ6wx/R0B25p7r/nUTcz6QFiB23gBizsnRkE CA72U12ZtkMmRKqgl+FTRy51lnRiizHqZgzAv0gliCMU1Tkn2rRJ3VMErgzuSEkx jbOvOadioFPUTwoE6NEdQgBnbv8C+LSGDKeC7gTscYZPq/8v8nuEyyxIeBfl/gk9 3IpjZrSKjAklGr+GGzNB =Yesu -----END PGP SIGNATURE----- --MGYHOYXEY6WxJCY8--