From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751761AbdE3OdB (ORCPT ); Tue, 30 May 2017 10:33:01 -0400 Received: from mx2.suse.de ([195.135.220.15]:53880 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751127AbdE3OdA (ORCPT ); Tue, 30 May 2017 10:33:00 -0400 Date: Tue, 30 May 2017 16:32:47 +0200 From: Michal Hocko To: Heiko Carstens Cc: Gerald Schaefer , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [-next] memory hotplug regression Message-ID: <20170530143246.GJ7969@dhcp22.suse.cz> References: <20170524082022.GC5427@osiris> <20170524083956.GC14733@dhcp22.suse.cz> <20170526122509.GB14849@osiris> <20170530121806.GD7969@dhcp22.suse.cz> <20170530123724.GC4874@osiris> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170530123724.GC4874@osiris> 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 On Tue 30-05-17 14:37:24, Heiko Carstens wrote: > On Tue, May 30, 2017 at 02:18:06PM +0200, Michal Hocko wrote: > > > So ZONE_DMA ends within ZONE_NORMAL. This shouldn't be possible, unless > > > this restriction is gone? > > > > The patch below should help. > > It does fix this specific problem, but introduces a new one: > > # echo online_movable > /sys/devices/system/memory/memory16/state > # cat /sys/devices/system/memory/memory16/valid_zones > Movable > # echo offline > /sys/devices/system/memory/memory16/state > # cat /sys/devices/system/memory/memory16/valid_zones > <--- no output > > Memory block 16 is the only one I onlined and offlineto ZONE_MOVABLE. Could you test the this on top please? --- diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 792c098e0e5f..a26f9f8e6365 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -937,13 +937,18 @@ void __ref move_pfn_range_to_zone(struct zone *zone, set_zone_contiguous(zone); } +/* + * Returns a default kernel memory zone for the given pfn range. + * If no kernel zone covers this pfn range it will automatically go + * to the ZONE_NORMAL. + */ struct zone *default_zone_for_pfn(int nid, unsigned long start_pfn, unsigned long nr_pages) { struct pglist_data *pgdat = NODE_DATA(nid); int zid; - for (zid = 0; zid < MAX_NR_ZONES; zid++) { + for (zid = 0; zid <= ZONE_NORMAL; zid++) { struct zone *zone = &pgdat->node_zones[zid]; if (zone_intersects(zone, start_pfn, nr_pages)) -- Michal Hocko SUSE Labs From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f198.google.com (mail-wr0-f198.google.com [209.85.128.198]) by kanga.kvack.org (Postfix) with ESMTP id 54EEB6B0279 for ; Tue, 30 May 2017 10:33:01 -0400 (EDT) Received: by mail-wr0-f198.google.com with SMTP id y43so6966209wrc.11 for ; Tue, 30 May 2017 07:33:01 -0700 (PDT) Received: from mx1.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id x26si12412994edx.74.2017.05.30.07.32.59 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 30 May 2017 07:33:00 -0700 (PDT) Date: Tue, 30 May 2017 16:32:47 +0200 From: Michal Hocko Subject: Re: [-next] memory hotplug regression Message-ID: <20170530143246.GJ7969@dhcp22.suse.cz> References: <20170524082022.GC5427@osiris> <20170524083956.GC14733@dhcp22.suse.cz> <20170526122509.GB14849@osiris> <20170530121806.GD7969@dhcp22.suse.cz> <20170530123724.GC4874@osiris> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170530123724.GC4874@osiris> Sender: owner-linux-mm@kvack.org List-ID: To: Heiko Carstens Cc: Gerald Schaefer , linux-mm@kvack.org, linux-kernel@vger.kernel.org On Tue 30-05-17 14:37:24, Heiko Carstens wrote: > On Tue, May 30, 2017 at 02:18:06PM +0200, Michal Hocko wrote: > > > So ZONE_DMA ends within ZONE_NORMAL. This shouldn't be possible, unless > > > this restriction is gone? > > > > The patch below should help. > > It does fix this specific problem, but introduces a new one: > > # echo online_movable > /sys/devices/system/memory/memory16/state > # cat /sys/devices/system/memory/memory16/valid_zones > Movable > # echo offline > /sys/devices/system/memory/memory16/state > # cat /sys/devices/system/memory/memory16/valid_zones > <--- no output > > Memory block 16 is the only one I onlined and offlineto ZONE_MOVABLE. Could you test the this on top please? --- diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 792c098e0e5f..a26f9f8e6365 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -937,13 +937,18 @@ void __ref move_pfn_range_to_zone(struct zone *zone, set_zone_contiguous(zone); } +/* + * Returns a default kernel memory zone for the given pfn range. + * If no kernel zone covers this pfn range it will automatically go + * to the ZONE_NORMAL. + */ struct zone *default_zone_for_pfn(int nid, unsigned long start_pfn, unsigned long nr_pages) { struct pglist_data *pgdat = NODE_DATA(nid); int zid; - for (zid = 0; zid < MAX_NR_ZONES; zid++) { + for (zid = 0; zid <= ZONE_NORMAL; zid++) { struct zone *zone = &pgdat->node_zones[zid]; if (zone_intersects(zone, start_pfn, nr_pages)) -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org