Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp641836ybz; Wed, 22 Apr 2020 05:20:19 -0700 (PDT) X-Google-Smtp-Source: APiQypIS6STxZwqCW7z6XDzeusp3c9ovvv5e6EXOLZ/T9xg7HzraOSoD/nZonNa4NjV1C5NI/Ocg X-Received: by 2002:a17:906:1292:: with SMTP id k18mr8208819ejb.132.1587558019093; Wed, 22 Apr 2020 05:20:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587558019; cv=none; d=google.com; s=arc-20160816; b=VNUaryA4/rqJeKT1TLIH0LLlItJ+quY+zpmI9w+JSEO4OaMjBoWZ2bTh2dGRrnRvvU rpZw5QyAGBMrehLJLRY6T7QC+DQWDq25wtWSGHG2TPuGtRzyMzXOEtMVfc8PmsBDxB/y Az61ZWbWYwOpSoRs8kbxlW/M1AHWVg7PwfZ41rveo2mU/pwuofSAjHCCqvTDVYoJ1yLo m7OHg/JdZ1y3gXL13XSU15nyi0+SUoxKaEWZrjztgPQuOGaX+LhSri7qzdyZNKlHycry 9bJI8px8dbVFr55g+ODXg9zZuLQPLDtXQKmcx7Nj1uFokUakOXeZZsOELMaIckSDg8Oj ymFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=hv49bv5UUTZ3NDUvU3H6y8LABTtvq3abK5gLpfIazmY=; b=qzAlDOKF+6mN5wU1B1dqIP8du4dBqirQiysIg1NeN+5Jr5zAjFeR8s6qJy++2+E7aG m5elPBxqk5y9oumVD8CPaHnDk8ydoNz2lnyECD8jzakyZsVXYtMpxfczrnKeiDoOA8UC cq+6THzYgP+LLyiWo8I1K0mfbhp+1AJ/xaw8WALuO/YYF7TVnwIWWnYhcO+CZru8OhSU DFMxzojT2WnXbUuB73Q5mT0x6nU5jelDvBsZa9/QyY9D2oBlOqnnOFKFd7QA40D7zpaA +QkOAh20nhTAqlrehX3ctSOmb4rJ6DYaGX18RoT/J3rBzcS0CEASzEdsd3cVbO2C3GPm qnpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e25si3487700edy.368.2020.04.22.05.19.46; Wed, 22 Apr 2020 05:20:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726751AbgDVKBL (ORCPT + 99 others); Wed, 22 Apr 2020 06:01:11 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:39389 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726721AbgDVKBD (ORCPT ); Wed, 22 Apr 2020 06:01:03 -0400 Received: by mail-wr1-f68.google.com with SMTP id b11so1650262wrs.6 for ; Wed, 22 Apr 2020 03:01:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=hv49bv5UUTZ3NDUvU3H6y8LABTtvq3abK5gLpfIazmY=; b=DZT65FdFVfLmnjdh9+jur5HmgX7lcvrMWPTtr3dYYKLvTtWiWYBIO+jsJ9QqNfNUT3 FmFNFb9KFnnoh4OacSoc4DZjUNBhfPT4pFwj9xIZUCKM27XVBa+s10ReVgjyLqsQCel/ +On8uxECOh08q3vpX1CnniNsC99q/N6MxgkawrC3blLYMDu1ErTudKP89actNpVYG+Kk 7UbaX//Yu9b1JqBn5Qyp6BIICRE7g0g8dDaBFlUnf/Kp/mlnzptAwPRgv6duqXdnWr0l 1GNqOPdXO+Els5jSFfjBchs4yAmBXXv9JuSF1i3TplFYqkRA4gu86lZPdH9Q+p0E5FCH +wyg== X-Gm-Message-State: AGi0PubUa75XUMSm1eI2AXehzh4cKrJtkD6bDX9rQqK+1m7/5vqZW+xq e6BhaFskrUrpibIFepEf5t4= X-Received: by 2002:a5d:4109:: with SMTP id l9mr27977934wrp.300.1587549661685; Wed, 22 Apr 2020 03:01:01 -0700 (PDT) Received: from localhost (ip-37-188-130-62.eurotel.cz. [37.188.130.62]) by smtp.gmail.com with ESMTPSA id q143sm7479880wme.31.2020.04.22.03.01.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2020 03:01:00 -0700 (PDT) Date: Wed, 22 Apr 2020 12:00:59 +0200 From: Michal Hocko To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Baoquan He , Oscar Salvador , Pankaj Gupta Subject: Re: [PATCH RFC 1/2] mm/memory_hotplug: no need to init new pgdat with node_start_pfn Message-ID: <20200422100059.GD30312@dhcp22.suse.cz> References: <20200416104707.20219-1-david@redhat.com> <20200416104707.20219-2-david@redhat.com> <20200421123011.GE27314@dhcp22.suse.cz> <20200421125250.GG27314@dhcp22.suse.cz> <20200422082101.GC30312@dhcp22.suse.cz> <47046122-ddf7-7a96-28f6-e8d57b356697@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47046122-ddf7-7a96-28f6-e8d57b356697@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 22-04-20 10:32:32, David Hildenbrand wrote: > On 22.04.20 10:21, Michal Hocko wrote: > > On Tue 21-04-20 15:06:20, David Hildenbrand wrote: > >> On 21.04.20 14:52, Michal Hocko wrote: > >>> On Tue 21-04-20 14:35:12, David Hildenbrand wrote: > >>>> On 21.04.20 14:30, Michal Hocko wrote: > >>>>> Sorry for the late reply > >>>>> > >>>>> On Thu 16-04-20 12:47:06, David Hildenbrand wrote: > >>>>>> A hotadded node/pgdat will span no pages at all, until memory is moved to > >>>>>> the zone/node via move_pfn_range_to_zone() -> resize_pgdat_range - e.g., > >>>>>> when onlining memory blocks. We don't have to initialize the > >>>>>> node_start_pfn to the memory we are adding. > >>>>> > >>>>> You are right that the node is empty at this phase but that is already > >>>>> reflected by zero present pages (hmm, I do not see spanned pages to be > >>>>> set 0 though). What I am missing here is why this is an improvement. The > >>>>> new node is already visible here and I do not see why we hide the > >>>>> information we already know. > >>>> > >>>> "information we already know" - no, not before we online the memory. > >>> > >>> Is this really the case? All add_memory_resource users operate on a > >>> physical memory range. > >> > >> Having the first add_memory() to magically set node_start_pfn of a hotplugged > >> node isn't dangerous, I think we agree on that. It's just completely > >> unnecessary here and at least left me confused why this is needed at all- > >> because the node start/end pfn is only really touched when > >> onlining/offlining memory (when resizing the zone and the pgdat). > > > > I do not see any specific problem. It just feels odd to > > ignore the start pfn when we have that information. I am little bit > > worried that this might kick back. E.g. say we start using the memmaps > > from the hotplugged memory then the initial part of the node will never> get online and we would have memmaps outside of the node span. I do not > > That's a general issue, which I pointed out as response to Oscars last > series. This needs more thought and reworks, especially how > node_start_pfn/node_spanned_pages are glued to memory onlining/offlining > today. > > > see an immediate problem except for the feeling this is odd. > > I think it's inconsistent. E.g., start with memory-less/cpu-less node > and don't online memory from the kernel immediately. > > Hotplug CPU. PGDAT initialized with node_start_pfn=0. Hotplug memory. > -> node_start_pfn=0 until memory is actually onlined. > > Hotplug memory. PGDAT initialized with node_start_pfn=$VALUE. Hotplug CPU. > -> node_start_pfn=$VALUE > > Hotplug memory. PGDAT initialized with node_start_pfn=$VALUE. Hotplug > CPU. Hotunplug memory. > -> node_start_pfn=$VALUE, although there is no memory anymore. > > Hotplug memory 1. PGDAT initialized with node_start_pfn=$VALUE. Hotplug > memory 2. Hotunplug memory 2. > -> node_start_pfn=$VALUE1 instead of $VALUE2. > > > Again, because node_start_pfn has absolutely no meaning until memory is > actually onlined - today. > > > > > That being said I will shut up now and leave it alone. > > Is that a nack? No it's not. Nor I am going to ack this but I will not stand in the way. I would just urge to have as many assumptions you are making and as much information in the changelog as possible. -- Michal Hocko SUSE Labs