From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18FE5C67861 for ; Tue, 9 Apr 2024 15:41:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 998136B0088; Tue, 9 Apr 2024 11:41:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 949686B008C; Tue, 9 Apr 2024 11:41:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80ECD6B0092; Tue, 9 Apr 2024 11:41:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 62F326B0088 for ; Tue, 9 Apr 2024 11:41:22 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D6C8816045B for ; Tue, 9 Apr 2024 15:41:21 +0000 (UTC) X-FDA: 81990407562.22.0F74FDD Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id 3701240016 for ; Tue, 9 Apr 2024 15:41:19 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hH5PjN18; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712677279; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=mXwPOKIWbXy/zqELmxZMuFWjpYOXj431wVIbkgxLg4I=; b=3EqJ9/aNxfFwEirB0J3q8cowgCxDQM6Z7HiJ3khj/Vn3ptA0U+/f5a95IEb2cmJQLA+qPE HZHc0zqaxZ7QKSyP0Fj44zeO4yvk8WSL7wuUN2iBt5kAlKphcLtIyMaDfx4tnvfYTGcnFJ zuLJNwJa8SWBnLMX7BHeimPug80GnBU= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hH5PjN18; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712677279; a=rsa-sha256; cv=none; b=iWR0XPcXHhiWaXQ6jX/u5pLvjSTfBRjcO7UBTcMweRnxTBKNuPxlXAYSZ/6HdorboSdSk+ bK5A9ITqhi92LAZ3Pb08DmaNtTS2SwY2nJnPWza4de/ayx6Q4SFH7XRHfHLdUo2yrywm+r 8kccJ49W+I2hOVZgzb6F/MbcmkB9NNM= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1C4356163F; Tue, 9 Apr 2024 15:41:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36DF9C433F1; Tue, 9 Apr 2024 15:41:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712677277; bh=JgmtGD2ZTd5u75lJbf+H7v8DCp03jL2bkXb2EoLRfIE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hH5PjN18NvQg5fe+Zv0ozqn36MzvpUyrGah9FGlTFEqqBf66+K84i1nzU9vwXJCCl 6zyijtfnUj9T+oc3H9TXTneuB9tut5iTDdtCGEfF6PZELqI0XQperkHHrvcS0L7zYc 5m7MvqC36NOPV1C0JjEWUIGFs7ecaYhZ2BRxPdDD5m8KQHO9koIZkeQh6xDzjkTxfW KZP7KeFyCcMsb2IaUUYNd4Aw2OhulqRblBczjNR6lDz79cpp2UH0qywtzpgWx/ovG9 zY59i38v1OKO8ldXbNfioCrkjgkVSypXJjf04VT2kHFKhLDeLX2xSu9kHNI7XsDQzr anSwf789YVVXw== Date: Tue, 9 Apr 2024 18:40:19 +0300 From: Mike Rapoport To: Baoquan He Cc: linux-mm@kvack.org, akpm@linux-foundation.org, mgorman@suse.de Subject: Re: [PATCH 2/7] mm/init: remove the unnecessary special treatment for memory-less node Message-ID: References: <20240326061134.1055295-1-bhe@redhat.com> <20240326061134.1055295-3-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 3701240016 X-Stat-Signature: zyhybhr7t69qk8y73j16ooar9and69bb X-Rspam-User: X-HE-Tag: 1712677279-721090 X-HE-Meta: U2FsdGVkX1+spGHkrV0c4f9ZQ6u5THzX4pVT5DFMoQmLDDUKdRTXT0g8TTDr8WhouYMw1FtBvEPqusQo60D0oNisrXQ0/7HXCXdg8LrzxprKxPKuyOYfMsnv5ESwWfcAvaEEGE94MXX6ruZ7tZIioRzIX3ZqU81ebUrAqF6U4uBo5Eb9Bo0pzT0VEVpSfTwiXmxkkYHqt2yy048hUn0/a/3m8XGvP9uB2eT45D7CtkMV2VerLe0lC1hKnYn34mSLdyjPLUGyrss0Uq0vmj3XwEUV/naVp5yLVXJrL8yp8ZUL5wYkHWsmAmmvw6E2xGXM1/DwULrDJS3fsKHVg5zt5WZ3RR/HNbgpkkErbGHcmnEp3EtPz/JeGXSuts42e1Vtd03vITOx0UQ0i08I3+wgNSDo7Y9sQxntqA/jasl6Py/+KL/pbBkeACNZEwSOiWou12sYDoiagvPwkho8nIbxzOxFyc2JyJenGdvA/yqwz5SmRQs6vz4IHNUN9zJLqzJg6tgOA7dlsCfHG6ZgUIFnG03LcXDVcKznTRhrTnAwaEzhr6bHFPPxajG5kKDIhqX/BPaa7LAEYn5YbTXkH6edDEFbzDXJ6nh+GGBgkCRLBdbnnP6pm2DmItFvPjTKBc2nxciMPHqr6sB29aR9FlzY4+5siNuAfj0gsszNeFHVPFhnNFpZX+50CHH/2ssrOd4ZcxnduFrw7NZO+HQLYT2orYtghhTLTfjK5RQJrHzQq2kTmntMKC2Ihba7UNskXVgXug2LDnCndf7BPJxM+Hrhy9PVeSY8DmUnK3ccch7ydRpTIZ6vR4SXrUCrhDfMyv1SLxELjpGbk8UxI10wlKYMag+SaSP6Ild1CeviGn44+I8Leb4Q0oCmFa7KlT6hCRRvtJAiAF3mICuk6a+Rk9E0bTOZPz3ZzSgvHZKc2G/cSYJKFf4U0gMyex/TZffma5la63EWkvEdhvjMYnMInl7 mtYSNxHN dBdJi26yO0/UfftuTBrMXbtgF71WzBgExIrMu7IJIa+roevyKtIdkTfOh4FfNdZmIAiimEz/UOBgOasJeNelbtrOthX6M5+E64HiPu0DQEfO44YMVDvgqfHG1aeOBe51NTcE8CqAygpZ+bATzCGzC04uecjughQG/4bFAR9jEDP0T1WXaKgMcpLSUdeoAeZBDAfe5CriO+klqMNhaDqBSl9TUpQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, Apr 04, 2024 at 11:23:51AM +0800, Baoquan He wrote: > On 04/02/24 at 11:32am, Mike Rapoport wrote: > > On Tue, Mar 26, 2024 at 02:11:28PM +0800, Baoquan He wrote: > > > Because memory-less node's ->node_present_pages and its > > > zone's ->present_pages are all 0, the judgement before calling > > > node_set_state() to set N_MEMORY, N_HIGH_MEMORY, N_NORMAL_MEMORY for > > > node is enough to skip memory-less node. The 'continue;' statement > > > inside for_each_node() loop of free_area_init() is gilding the lily. > > > > > > Here, remove the special handling to make memory-less node share the > > > same code flow as normal node. And the code comment above the 'continue' > > > statement is not needed either. > > > > > > Signed-off-by: Baoquan He > > > --- > > > mm/mm_init.c | 18 +++--------------- > > > 1 file changed, 3 insertions(+), 15 deletions(-) > > > > > > diff --git a/mm/mm_init.c b/mm/mm_init.c > > > index 089dc60159e9..99681ffb9091 100644 > > > --- a/mm/mm_init.c > > > +++ b/mm/mm_init.c > > > @@ -1834,28 +1834,16 @@ void __init free_area_init(unsigned long *max_zone_pfn) > > > panic("Cannot allocate %zuB for node %d.\n", > > > sizeof(*pgdat), nid); > > > arch_refresh_nodedata(nid, pgdat); > > > - free_area_init_node(nid); > > > - > > > - /* > > > - * We do not want to confuse userspace by sysfs > > > - * files/directories for node without any memory > > > - * attached to it, so this node is not marked as > > > - * N_MEMORY and not marked online so that no sysfs > > > - * hierarchy will be created via register_one_node for > > > - * it. The pgdat will get fully initialized by > > > - * hotadd_init_pgdat() when memory is hotplugged into > > > - * this node. > > > - */ > > > > I think this comment is still valuable. Maybe rephrase it a bit and move it > > before 'if (pgdat->node_present_pages)'? > > Fair enough. > > Do you think below paragraph is OK to you? Please help polish or > rephrase it. > > diff --git a/mm/mm_init.c b/mm/mm_init.c > index dd875f943cbb..3ce0f29637ba 100644 > --- a/mm/mm_init.c > +++ b/mm/mm_init.c > @@ -1839,7 +1839,14 @@ void __init free_area_init(unsigned long *max_zone_pfn) > pgdat = NODE_DATA(nid); > free_area_init_node(nid); > > - /* Any memory on that node */ > + /* > + * No sysfs hierarcy will be created via register_one_node() > + *for memory-less node because here it's not marked as N_MEMORY > + *and won't be set online later. The benefit is userspace > + *program won't be confused by sysfs files/directories of > + *memory-less node. The pgdat will get fully initialized by > + *hotadd_init_pgdat() when memory is hotplugged into this node. > + */ Ack > if (pgdat->node_present_pages) { > node_set_state(nid, N_MEMORY); > check_for_memory(pgdat); > -- Sincerely yours, Mike.