Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752833AbdFPILs (ORCPT ); Fri, 16 Jun 2017 04:11:48 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:35346 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752352AbdFPILq (ORCPT ); Fri, 16 Jun 2017 04:11:46 -0400 Date: Fri, 16 Jun 2017 16:11:42 +0800 From: Wei Yang To: Michal Hocko 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 , Michal Hocko , 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: <20170616081142.GA3871@WeideMacBook-Pro.local> Reply-To: Wei Yang References: <20170515085827.16474-1-mhocko@kernel.org> <20170515085827.16474-12-mhocko@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AqsLC8rIMeq19msA" Content-Disposition: inline In-Reply-To: <20170515085827.16474-12-mhocko@kernel.org> 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: 2674 Lines: 79 --AqsLC8rIMeq19msA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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! 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 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_HOTPLU= G); >+ 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); > } memmap_init_zone()->__init_single_page()->set_page_links() Do I miss something that you call set_page_links() explicitly here? --=20 Wei Yang Help you, Help me --AqsLC8rIMeq19msA Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIbBAEBCAAGBQJZQ5K9AAoJEKcLNpZP5cTdy24P+I9NC7LQ0mVVp4mF8M36iAus 6BwFp8fa28F8Gh4np7Ksc9XbBYEqFVlJ1fE+U4bBojHslvaeZRNmKZcQHR5QgJ9Q tFUYVl9gs09HRIdGANhCcy2/kcjGAhJEj051UeqtSDwFBtssDqnCLJfdPa3FuZSN +vy3vJcUFu97GCnonS+A/HxKyovQEOQYAwufMa6GI11bdM1Ro6HUQcX2V/w2xp4c dOYaFhqIppzgjHK72O1o9SkAuKC903CEcJ4hEzypw01xf27CGiLq00UhbW5eDnYz u5kmKz2KCOCSTYTlh9IvYvQbJKd4k8o1HI/vBAREmGBWuAf/Q0aS9Xvo8EaPfCtw feGBW9ETLnea7LoZP1Why6qarZu/r+crJdiCTPjaPHuLaHdej4xkplnCJRALvqs3 RjgJbcqsj5clIg11GfPgwBzU3nvyM5q1fD/TAnDIlihyRoDPnPe8fVL/xgiGh2qR 9F/Il4OnKM9f7I6d13bcLPXEsyqjHA9L7A/a/RU+sGqH97kmHQzKpDSndHSvkOFF luRbnClwl6OwzLtH4HmPoXQERPnRvKEgFjXxWJHAUg/wV9oUj8qehytJhtCdL01n nbgJYoClzC5RLrh5G3j2bNGPrvpGWVwjU9IBkpQ4H5TZp43LOf3yId3Eq9AOk9+/ m+4Rm2mSWEp9iQ+w61s= =8E87 -----END PGP SIGNATURE----- --AqsLC8rIMeq19msA--