From patchwork Tue Mar 26 06:11:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13603605 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 CBEAEC54E67 for ; Tue, 26 Mar 2024 06:11:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 469766B0085; Tue, 26 Mar 2024 02:11:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4178D6B0087; Tue, 26 Mar 2024 02:11:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26B936B0088; Tue, 26 Mar 2024 02:11:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 08D476B0085 for ; Tue, 26 Mar 2024 02:11:55 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A58C81C084A for ; Tue, 26 Mar 2024 06:11:54 +0000 (UTC) X-FDA: 81938169348.02.C61CE0D 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 DA2351C0013 for ; Tue, 26 Mar 2024 06:11:52 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=cL5xYl+o; spf=pass (imf21.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711433512; a=rsa-sha256; cv=none; b=Q/9CqbZXr/KKZA1uWpkdEtMmvYAwrJoZeHbJ6DDRNvt+51cOz6WD0XVBH+UD6klRIF0nUq Zu1xk6Ja/1Xug4srEe9qt0SH9jAZlDK6WNKzwv/noBUeGrXNHBFtJe69XcHpMolLo00jOx WxKscca1jYn6UXtOspOYN3M6ItQtzAI= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=cL5xYl+o; spf=pass (imf21.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711433512; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wNbJUTamfWLGhNZqABfVMlJmVmVJ2sSKLjjKRbFhlPE=; b=LpdUaE5qbTCOsPGa/dKt74CgQBkDf3eGiTSHKX6LBDbkSatEtN8TsHXK1srsXorZcTt7jq wziknFEVzVx91yJ7ldcFfyYxHclCuNcVMg1ImH/FS5x3F0/79f8kAmPtm9zkzqYVwWo0gl AVjbebHLCn4SCO3s9UIAsA10vX1HZQc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711433512; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wNbJUTamfWLGhNZqABfVMlJmVmVJ2sSKLjjKRbFhlPE=; b=cL5xYl+oDeX5AXnJQH5WT3ojbTFgxNsHWc1jLr85O3Fv00qBIrwu+vAA2V7rJog58rNKwf TMhxjr07l+t1wX+OKK7+1fZSIk0W958A/KL24YNOC6Xo9kmTKEWTW3DI2hstuOcs6ey3R5 ZJNW5XMilSipM2XmqHlDQJRF7H7plLE= 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-272-DvusLvZGNKiU0Ubuav3P3w-1; Tue, 26 Mar 2024 02:11:48 -0400 X-MC-Unique: DvusLvZGNKiU0Ubuav3P3w-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 79ECC3C0D842; Tue, 26 Mar 2024 06:11:48 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43D771074E; Tue, 26 Mar 2024 06:11:45 +0000 (UTC) From: Baoquan He To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, rppt@kernel.org, mgorman@suse.de, Baoquan He Subject: [PATCH 2/7] mm/init: remove the unnecessary special treatment for memory-less node Date: Tue, 26 Mar 2024 14:11:28 +0800 Message-ID: <20240326061134.1055295-3-bhe@redhat.com> In-Reply-To: <20240326061134.1055295-1-bhe@redhat.com> References: <20240326061134.1055295-1-bhe@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-type: text/plain X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: DA2351C0013 X-Stat-Signature: 95zoq14a8rt9zefxjhyfzuzrpcm8nsja X-Rspam-User: X-HE-Tag: 1711433512-697414 X-HE-Meta: U2FsdGVkX18myxH5HKU+ImtBhXFudtHqI34qcMSWQu+XgdUASHmLmPWcBJG1eN/2gOB757WwYuiCP6EzZS0cHVM11vUaf3p96jwKb/0YdPGEy86GyExdJqyFHhTeBjamufAqPdXQRVxkv4NX3+mc928z7fqKxVzz4F/rKqDTI7gKdESWnG/cdnp/MbEN2yAxnV/TcctjkaC2snxsDIflc35mFirpjyISrYze4gG2OqdMWGAwFg049+PkoXegmTE6b+MP67mreEvUa4A4vg5xQjrm1DYFYSg3GiJ1VdGL745Vca/tDrk+sF3Rd+cWnkX5wRoNN/hqlfHv/JozlrMFgcMJrwTsI5t5F6gfZ/XIOXLs0NTNoYj/0plyt9O9ml9hFfloTDUeikb5Nt82w7fZK0rBRg/u/0c4GaFMKx+ftj9jrGlXln4HJ3MwYmPyAxNITSRbJgFGVGIsh/OF7ti8DbicT2HC6ESADC3Z35EhGGIkWRNn1f/0EWvbe+AF9AOg5oJmFUVFmXCwStbgMESVle8f1dNup/1aBlvMPBp/Ctl4u2f688HrFjW+QpA4nz8HUoNrDrwht5la7VbNqET4ZfQ14mcRrytvFZStboAI0j4KSCQQrEJ4emwdjTOD8Ia3qR+VWe1iQIlCNq2AWaQQzhrEGDK2/c7HDpuvwfiaOh0nfZyP0myCXd0Nmp6KId2jSVO80MR2tddotNkBIuUxy3yCO27A8bo/8fThLzpGi54t+pgIEhwVaZX50kdaTFZeJ0TlKC/cilvuQTP6iv1UZixLffAGLlsInRvHRSLTTcE7clGAO+qJP3l+7JtmRJeogOMTByTJYpihk/0wB4Amd8QDlGRlN9lxqd6kCSnLGEe0WmxAArVqfNV+dX7z7scPKZ/rpp3uyvg= 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: 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 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. - */ - continue; } pgdat = NODE_DATA(nid); free_area_init_node(nid); /* Any memory on that node */ - if (pgdat->node_present_pages) + if (pgdat->node_present_pages) { node_set_state(nid, N_MEMORY); - check_for_memory(pgdat); + check_for_memory(pgdat); + } } calc_nr_kernel_pages();