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 642AECD11C2 for ; Wed, 10 Apr 2024 03:38:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D824F6B0085; Tue, 9 Apr 2024 23:38:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D32B56B0087; Tue, 9 Apr 2024 23:38:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BFA366B0088; Tue, 9 Apr 2024 23:38:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A04A26B0085 for ; Tue, 9 Apr 2024 23:38:29 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 305968060F for ; Wed, 10 Apr 2024 03:38:29 +0000 (UTC) X-FDA: 81992214738.15.83AC011 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf01.hostedemail.com (Postfix) with ESMTP id 87A4B4000D for ; Wed, 10 Apr 2024 03:38:26 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=G6GxqOzR; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf01.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712720307; 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=DS0PIe9PS1FDCX26kxFDJeUebPDC5OF1TvS2+QZZ2E4=; b=Dpm3yi5GIqvGd9enLq7BHIzKe9eXsXne9DZQ0RB2D3HCKnQLnrQn24jOQrmyaCxnPkok5z zuAL2t/QeVo0QHyYE5JBiqzBhrAA1X+Ec2yiFDvpWp4kUZr2F3/8DqQHjLeVmJtGQSeoYV j9Du1jzCJcos4uos4BLi30nCGhDdwaU= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=G6GxqOzR; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf01.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712720307; a=rsa-sha256; cv=none; b=p6x94+RAG8YjJvx/Cu0Hi3EwV9zRdJ8aDSiRlmdvZiPUD70F4J8R1Q5SFn8rItCtA6DdD9 DVU/gPkdgmeT7HXcjwZsH++ssihq1faOB82sHE6NzUGpIS+QtaouPOVdh8DpO92Ik4Rd04 dOHqw20zp0IfDaevZSqhracHHEOczkA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712720305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DS0PIe9PS1FDCX26kxFDJeUebPDC5OF1TvS2+QZZ2E4=; b=G6GxqOzRvBiqJNHoJX85Vv6WoA2c/mZqgu6WdbJggs82/8WMvNXed5CnzQvITY7B+AYCBc HUbyfVl6hvCAb9GZBSyLoo43WN5XS5N5X+tyD1MXfPlr7Dh0LLv+b45u6sar03kV/bruYD 7V8Z64g1cV6J5lm8IGWuLg35viEiw18= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-103-CG_IoR5kO1K3ZMM7rdVvuA-1; Tue, 09 Apr 2024 23:38:22 -0400 X-MC-Unique: CG_IoR5kO1K3ZMM7rdVvuA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C9449806626; Wed, 10 Apr 2024 03:38:21 +0000 (UTC) Received: from localhost (unknown [10.72.116.50]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 29245C04227; Wed, 10 Apr 2024 03:38:20 +0000 (UTC) Date: Wed, 10 Apr 2024 11:38:14 +0800 From: Baoquan He To: Mike Rapoport , akpm@linux-foundation.org Cc: linux-mm@kvack.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 In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 87A4B4000D X-Stat-Signature: iawzajo4hqdc15hfhitw5rot9s41cjxa X-Rspam-User: X-HE-Tag: 1712720306-915647 X-HE-Meta: U2FsdGVkX1/SM1/zB4XMxSknWZzLhFjABnJbIoXBeVUE7c6eTFAqW6nltKSCH5gHl9gGbvEy2lb56yU569P0G0bs0Qg929bZM9R6pVmvX/bz+o2QPI83e2y+ZQ4MwVRXa4W9XDM5AhJFhDqoKacC63kYQ1KZubH6rqk4dRpeGcQoNa5lWQqV9Lrx+5CUdv1CmND0qUe/HWk1iI8L3MQNtyZOWSO07dmp04WfKt67EA3WBU3J33CSRn5v70TzsB2MgC8S41l5K+OQgKxUReeqIK0jE8pIDof/X6CNYKerD5nl/zv7eJJuvI0BmjH8mu5xWYMQ1MVjABCUfvDg6m3kZgtqSoQAg3F+Tpcz1VpTGswBqoYrjGKFqkcwAZqImDPKNsyKD1sXoCue3E6V8DvDQtwyT7h4FbSa/CU5tC0y8vCtykqtWGLhGyyOIjKl3HLh7ggADqXn8GCwYJgOCmrvNmTW1pcEi4/QwZtIkm8fGGOojLEB8a39ygEJA8oCQ/UbJPvn0gJ19HltAOsjLB1IfWLLT/suZ0s63lw0qbGMNTdRN1Y1VJwztFwRzWlOkIUHaDsGtwjddy35fR5c+EexFtDmTU+mzrxkcfWCbEboZkfwgSOnQZA5gXwZKoJGBNEnSAIUM+JzK0PywAFOZh/fop+4Bnu82wOY2IlyYYR/SlVXyjZvkWC2u5OLKH5pDSGXJphKSiFQAtXXiVyGgsmmDvZ6YD/hGNFEW6wypv7tavePSS5T2jrrc5UmqVy66cKaT8T+dn/riNmy5iO7KmFFbOYqyT3PQ0YZ/eYWFOpfY5LM4m7Cgd8SCxBFBcPOBWAe9I8HywKKXYyketU3flE6CB9UmQFTsEt4DS0fLmIs/qIX0hEGxJdRXT973FNFkm/Fr+2zn1AHOEfaOm72NN+0BQ== 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 04/09/24 at 06:40pm, Mike Rapoport wrote: > 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 Thanks a lot for reviewing and confirming, Mike. Hi Andrew, I have sent out v2 to include above code comment changing, please feel free to pick the draft patch and append, or take the newly post v2. Thanks. > > > if (pgdat->node_present_pages) { > > node_set_state(nid, N_MEMORY); > > check_for_memory(pgdat); > > > > -- > Sincerely yours, > Mike. >