Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp99694ybz; Tue, 21 Apr 2020 05:32:25 -0700 (PDT) X-Google-Smtp-Source: APiQypLsLhNBfxfxjnSi55Kbo2Z4Oq0bYsGs7qsyoQV/k+h3CGpSnjOyjiG7yMh3g5rfq2lU0V3a X-Received: by 2002:a17:906:7f01:: with SMTP id d1mr20346355ejr.49.1587472345672; Tue, 21 Apr 2020 05:32:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587472345; cv=none; d=google.com; s=arc-20160816; b=YOb7xGyYYdVZQfaLf4wLFAWsoMGP88UGoMcXCmZVkBWBgKlX/RjpZGKKbPlcoKVzdw AcYRTKoeixoyPtPWt/bVsqe8Ay/Emm1qBoo/W+EBFoY/82sCsKqRjZGOZmAl7cZxCb06 QMt/F+1U4ekPub7gXJ1iuyCHQrAz0eJX7vkPrJVMuF8J10o6awy67pfDUYXB+nZUuQR+ +mCwNPfv72IF7k5PYqjaszUqpPKF3MWBmsgpSCip5o1Qy7Rlywr1n3xrek+XJK6/v+bR HPlBmuMubyoPe4dhhvlqYIyJuMoTTCWNpjqxg2eXuI+gcUo9MqSwtubQpsNU3DW5P6dT TD6g== 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=pAwHkcOQqZAPUApEDJqSOvDREKT9CtAZr9rAL5nNWm8=; b=e5fJDPSCzgaLf4DswBfzwWmxJx16Ljr6rm4CC7HU0B7EQhZ5AbVJJprAmym8arbVsl /UQUV1C7xlIs8CMZRPf1eVuOuRo00f2HQd6prNAPOtzxFQ3VnQfqGEoEK1qD26/rcgpj xCy/TkjeaXOuB5vkTRyNtE8x2+I9SR7PGTefeDQfNw8aRTk5cgVT6IbOBpVVVSAjy3Rs bX5VW6DbxoVduub5fRwb5kwvZIZM0pdJn4xeQ7wLMjeS4vxBCmEYSeIIGcA1sXfx5e6V UdAu14t2YUuafz6icKUqPx1Hmn20IB6GcZoddQ/xa0SiRHU91o8AKM+E9E7u4RibJfJh RetQ== 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 z15si1569819eju.349.2020.04.21.05.32.02; Tue, 21 Apr 2020 05:32:25 -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 S1728817AbgDUMaR (ORCPT + 99 others); Tue, 21 Apr 2020 08:30:17 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:39320 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726018AbgDUMaR (ORCPT ); Tue, 21 Apr 2020 08:30:17 -0400 Received: by mail-wm1-f68.google.com with SMTP id y24so3457569wma.4 for ; Tue, 21 Apr 2020 05:30:14 -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=pAwHkcOQqZAPUApEDJqSOvDREKT9CtAZr9rAL5nNWm8=; b=Im3QmORhPNKSuGvzSQ49JChgxiIsy6t3n1gQN499MYnwVUbtYaGu4lboDxpqqTETUp 4DdktlkfpyEPm/wDjIrMAeG7Ybcw74/0oacWw0k7JBk+WTCSmoo55FP+g6FBTNjW1VmJ inG28qYVw+OFYqZZj1rZD/eFZ5AoWwF8TnzZxRE1MmL/vXB1RpJHVZ9orXtKkYh+365T CTQYGNnrn6z78bneYxT6XLFRSG597GjdWkGe3kfKnBgbYD05oIH+3o4DrRJcllniGGEy fQdx6B08P700i70PLlhaL1rV310FENbr/m9O1I+K9sq7Fnu7i+GvHaxofIggRfFGhDMs fo6Q== X-Gm-Message-State: AGi0PuaaFGlmkrHj11Ig+k9HLE0++now82O0YsA4Rg11Pi0Mj0irxIzT AzvPfWr4EXhpBP7Iy6RdXQY= X-Received: by 2002:a05:600c:2903:: with SMTP id i3mr4621413wmd.65.1587472213583; Tue, 21 Apr 2020 05:30:13 -0700 (PDT) Received: from localhost (ip-37-188-130-62.eurotel.cz. [37.188.130.62]) by smtp.gmail.com with ESMTPSA id l19sm3374267wmj.14.2020.04.21.05.30.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 05:30:12 -0700 (PDT) Date: Tue, 21 Apr 2020 14:30:11 +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: <20200421123011.GE27314@dhcp22.suse.cz> References: <20200416104707.20219-1-david@redhat.com> <20200416104707.20219-2-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200416104707.20219-2-david@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > Note: we'll also end up with pgdat->node_start_pfn == 0 when offlined the > last memory block belonging to a node (via remove_pfn_range_from_zone()-> > update_pgdat_span()). > > Cc: Andrew Morton > Cc: Michal Hocko > Cc: Baoquan He > Cc: Oscar Salvador > Cc: Pankaj Gupta > Signed-off-by: David Hildenbrand > --- > mm/memory_hotplug.c | 15 ++++++--------- > 1 file changed, 6 insertions(+), 9 deletions(-) > > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index 47cf6036eb31..9b15ce465be2 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -866,10 +866,9 @@ static void reset_node_present_pages(pg_data_t *pgdat) > } > > /* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */ > -static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start) > +static pg_data_t __ref *hotadd_new_pgdat(int nid) > { > struct pglist_data *pgdat; > - unsigned long start_pfn = PFN_DOWN(start); > > pgdat = NODE_DATA(nid); > if (!pgdat) { > @@ -899,9 +898,8 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start) > } > > /* we can use NODE_DATA(nid) from here */ > - > pgdat->node_id = nid; > - pgdat->node_start_pfn = start_pfn; > + pgdat->node_start_pfn = 0; > > /* init node's zones as empty zones, we don't have any present pages.*/ > free_area_init_core_hotplug(nid); > @@ -936,7 +934,6 @@ static void rollback_node_hotadd(int nid) > /** > * try_online_node - online a node if offlined > * @nid: the node ID > - * @start: start addr of the node > * @set_node_online: Whether we want to online the node > * called by cpu_up() to online a node without onlined memory. > * > @@ -945,7 +942,7 @@ static void rollback_node_hotadd(int nid) > * 0 -> the node is already online > * -ENOMEM -> the node could not be allocated > */ > -static int __try_online_node(int nid, u64 start, bool set_node_online) > +static int __try_online_node(int nid, bool set_node_online) > { > pg_data_t *pgdat; > int ret = 1; > @@ -953,7 +950,7 @@ static int __try_online_node(int nid, u64 start, bool set_node_online) > if (node_online(nid)) > return 0; > > - pgdat = hotadd_new_pgdat(nid, start); > + pgdat = hotadd_new_pgdat(nid); > if (!pgdat) { > pr_err("Cannot online node %d due to NULL pgdat\n", nid); > ret = -ENOMEM; > @@ -977,7 +974,7 @@ int try_online_node(int nid) > int ret; > > mem_hotplug_begin(); > - ret = __try_online_node(nid, 0, true); > + ret = __try_online_node(nid, true); > mem_hotplug_done(); > return ret; > } > @@ -1031,7 +1028,7 @@ int __ref add_memory_resource(int nid, struct resource *res) > */ > memblock_add_node(start, size, nid); > > - ret = __try_online_node(nid, start, false); > + ret = __try_online_node(nid, false); > if (ret < 0) > goto error; > new_node = ret; > -- > 2.25.1 -- Michal Hocko SUSE Labs