Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752774AbbG3Qlm (ORCPT ); Thu, 30 Jul 2015 12:41:42 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:27874 "EHLO SMTP02.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751352AbbG3Qll (ORCPT ); Thu, 30 Jul 2015 12:41:41 -0400 X-IronPort-AV: E=Sophos;i="5.15,577,1432598400"; d="scan'208";a="289429115" Message-ID: <55BA53AF.8050406@citrix.com> Date: Thu, 30 Jul 2015 17:41:19 +0100 From: David Vrabel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: Mel Gorman CC: , , Robin Holt , Nathan Zimmer Subject: Re: [PATCHv1] mm: always initialize pages as reserved to fix memory hotplug References: <1438265083-31208-1-git-send-email-david.vrabel@citrix.com> <20150730144554.GS2561@suse.de> In-Reply-To: <20150730144554.GS2561@suse.de> Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit X-DLP: MIA1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2767 Lines: 75 On 30/07/15 15:45, Mel Gorman wrote: > On Thu, Jul 30, 2015 at 03:04:43PM +0100, David Vrabel wrote: >> Commit 92923ca3aacef63c92dc297a75ad0c6dfe4eab37 (mm: meminit: only set >> page reserved in the memblock region) breaks memory hotplug because pages >> within newly added sections are not marked as reserved as required by >> the memory hotplug driver. > > I don't have access to a large machine at the moment to verify and won't > have until Monday at the earliest but I think that will bust deferred > initialisation. > > Why not either SetPageReserved from mem hotplug driver? It might be neater > to remove the PageReserved check from online_pages_range() but then care > would have to be taken to ensure that invalid PFNs within section that > have no memory backing them were properly reserved. This is an untested, > uncompiled version of the first suggestion Thanks. Tested-by: David Vrabel 8<------------------------------ >From 0c1acd3118d8bb911566c0af8f759fccbd90fb9e Mon Sep 17 00:00:00 2001 From: Mel Gorman Date: Thu, 30 Jul 2015 15:45:54 +0100 Subject: [PATCH] mm: initialize hotplugged pages as reserved Commit 92923ca3aacef63c92dc297a75ad0c6dfe4eab37 (mm: meminit: only set page reserved in the memblock region) breaks memory hotplug because pages within newly added sections are not marked as reserved as required by the memory hotplug driver. Set hotplugged pages as reserved when adding new zones. Tested-by: David Vrabel --- mm/memory_hotplug.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 460d0fe..169770a 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -446,7 +446,7 @@ static int __meminit __add_zone(struct zone *zone, unsigned long phys_start_pfn) int nr_pages = PAGES_PER_SECTION; int nid = pgdat->node_id; int zone_type; - unsigned long flags; + unsigned long flags, pfn; int ret; zone_type = zone - pgdat->node_zones; @@ -461,6 +461,14 @@ static int __meminit __add_zone(struct zone *zone, unsigned long phys_start_pfn) pgdat_resize_unlock(zone->zone_pgdat, &flags); memmap_init_zone(nr_pages, nid, zone_type, phys_start_pfn, MEMMAP_HOTPLUG); + + /* online_page_range is called later and expects pages reserved */ + for (pfn = phys_start_pfn; pfn < phys_start_pfn + nr_pages; pfn++) { + if (!pfn_valid(pfn)) + continue; + + SetPageReserved(pfn_to_page(pfn)); + } return 0; } -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/