From patchwork Mon Mar 25 15:04:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13602389 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 7350FC54E64 for ; Mon, 25 Mar 2024 15:05:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 03E816B00A4; Mon, 25 Mar 2024 11:05:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EE28F6B00A6; Mon, 25 Mar 2024 11:05:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D82766B00A8; Mon, 25 Mar 2024 11:05:39 -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 C33786B00A4 for ; Mon, 25 Mar 2024 11:05:39 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id A4A8A160203 for ; Mon, 25 Mar 2024 15:05:39 +0000 (UTC) X-FDA: 81935885598.27.3F01DFD Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf01.hostedemail.com (Postfix) with ESMTP id 700864001A for ; Mon, 25 Mar 2024 15:05:36 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="bDtl/bfk"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf01.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=1711379137; a=rsa-sha256; cv=none; b=8LgyfFSKGR0TEcjniTKTamNiWKmB9rSe+kzHghZ2AV2qpHEyztlpAH3jH/JNzxQu7cEPxN yHF1Qdu/KTG2wt6U2oUwQml6v4Xnh3xJ7eRSItLrlZxc9MnmSN5VJJF6svRPV3kZHMild/ x8Zq4DdsxuuITByvlCNeqrDFcXz/XHM= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="bDtl/bfk"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf01.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=1711379137; 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=qvedRKBdNPe329JGR4eKIyjoBf0iHKOi4XVoSJv8xLZIs/hDmKJZMv2KeMpDbVs9o0nxfN bn38ZsrOApkiEEoHK3vvbDJjAwf2UGh29PzO7EYRJWyCY6JWKn2bhPNy07aHz8q0M+MPdi 0epAXSvWhT11u2lrhLHMCFLfRGoPKrI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711379136; 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=bDtl/bfk91N+qd2fWmK6vokzO2lcI/87fk3pWiW44/oTfRCIGvTH1AhTAGfFzEpFKdDpqT NtY2TW9M4+YQfNIQ/BEUDafa677Nx1OXYJMJB0ratcoHnwuLlOKqXVMv07n4S1dP3hte1O 9ff0EQCAQ2TmYc11UXI2tZx8nyvy53s= 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-662-kO_TMJkuPg-FmYUEcG3pkQ-1; Mon, 25 Mar 2024 11:05:30 -0400 X-MC-Unique: kO_TMJkuPg-FmYUEcG3pkQ-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 5B57F28C97EB; Mon, 25 Mar 2024 15:05:30 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id E7F8DC04120; Mon, 25 Mar 2024 15:05:26 +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 7/7] mm/init: remove the unnecessary special treatment for memory-less node Date: Mon, 25 Mar 2024 23:04:59 +0800 Message-ID: <20240325150459.1045407-8-bhe@redhat.com> In-Reply-To: <20240325150459.1045407-1-bhe@redhat.com> References: <20240325150459.1045407-1-bhe@redhat.com> MIME-Version: 1.0 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 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 700864001A X-Stat-Signature: 3taix1teftgx3nqgc5m9ujx4ot3gnqqo X-HE-Tag: 1711379136-608806 X-HE-Meta: U2FsdGVkX18X3D+t97ClFf5sLsVzDRcuWkxTL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idrjzen2SjlzRlFG0uScoVAX+BzD3PK87U4jlrNn/gKgdJiF+haAr3S/tY= 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 --- 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();