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 2ACFECD1288 for ; Thu, 4 Apr 2024 03:24:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4AC096B0083; Wed, 3 Apr 2024 23:24:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 45C546B0087; Wed, 3 Apr 2024 23:24:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 323F56B0089; Wed, 3 Apr 2024 23:24:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 15B0D6B0083 for ; Wed, 3 Apr 2024 23:24:11 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id BF5F0A1413 for ; Thu, 4 Apr 2024 03:24:10 +0000 (UTC) X-FDA: 81970405860.23.C6A70C6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf21.hostedemail.com (Postfix) with ESMTP id D598F1C000C for ; Thu, 4 Apr 2024 03:24:08 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=H7S7sBYP; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf21.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.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=1712201049; 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=RnLoswlOHjnLUWphKoFp5V0zkITV3YPlz3vyrTs5Ux0=; b=Hz7syAY4O+9D3BFqfXAy9Q/IV2C14L1gXDZNQ5FzfHA/cc67KonmOwNiRkT59qek7+8mj5 7RYPny76kkOoJkvbDOKdeiKOukgRK8cz5NRDdh6ydnuIuISRZhytYwmTR3FU/em5N82X4z Uftiwb5IUa+hsvvShbhH2n6aPGhNtO8= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=H7S7sBYP; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf21.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712201049; a=rsa-sha256; cv=none; b=NwR8e261M+Br9QwZ1ggG0Y72+wgx0h1nrFQHk7DsKtglzlYw4Ml2v7aMSxdJwg4KUuqZ3w Q6aG8n32yjq1KyjNgtmgW3sVLBTV04enJVFUPaCcyPTcMCk7Lp/KOKUtaLGz2O5w2+6Xod xOnTrRQQ7AnnazCcxR9kPujFyyrCyf0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712201048; 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=RnLoswlOHjnLUWphKoFp5V0zkITV3YPlz3vyrTs5Ux0=; b=H7S7sBYPqUJUVZmsxnsJA04YqFwgFwFwxQDMbHcN3iS8y0g7L09ABELVawZrqlMgGpreke 0amraOrOIPkogtd4AiEYjGEMhk7YvmGY0bLLx73QZNqWXcbc2HGwMkyxE4ObK6uPPAOh0x 7om96i4cjsLFpxa+Cl1BukcEQeh8gb4= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-492-Weq2mFpuOtej8Np7XwFluQ-1; Wed, 03 Apr 2024 23:24:04 -0400 X-MC-Unique: Weq2mFpuOtej8Np7XwFluQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 618963806704; Thu, 4 Apr 2024 03:24:04 +0000 (UTC) Received: from localhost (unknown [10.72.116.50]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8AA6F1121312; Thu, 4 Apr 2024 03:24:03 +0000 (UTC) Date: Thu, 4 Apr 2024 11:23:51 +0800 From: Baoquan He To: Mike Rapoport 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 In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D598F1C000C X-Stat-Signature: 6gf9fyazsyfrde7jp6smzmcyior3fj3e X-HE-Tag: 1712201048-490261 X-HE-Meta: U2FsdGVkX1/Rk1+FrD5+Wz5tDXPjyuOWzYQxlR1m13EskYgHloZ3lXLa9C+iGBOiJ0GFGkhPisCtvMErAtZhX6Jm4hb88/nzU+bAqoKH7h74Yat7XKWLA/LWQI0zw5Kqu2govn3nsqyW+VeCiB60yVAzYDw38qIRSFJKRPi/NGzFzXpaVyovXO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owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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. + */ if (pgdat->node_present_pages) { node_set_state(nid, N_MEMORY); check_for_memory(pgdat);