Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp944172rwo; Wed, 2 Aug 2023 06:38:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlFsF37lIqwyBhM/Marg2YRbz6qrUPC/YVkVszD1aWt6ZtfzrCcbR7MPQkPpWn05d2q0q9CZ X-Received: by 2002:a17:903:22c7:b0:1b8:9552:2249 with SMTP id y7-20020a17090322c700b001b895522249mr17294210plg.43.1690983483767; Wed, 02 Aug 2023 06:38:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690983483; cv=none; d=google.com; s=arc-20160816; b=ZRzyyRC4djUPrG9cMZCyrtBUEfAnzMtqNcQrVY1xAGHiyl40pKZOXIJXncXOqPSM49 qGcL+gPV+OJk/bh2M1NSefa5zSze7LavqWTHz6dbVK0awA0FvSfeNH3A6/KpggpaCrND 9NP0VgEml9jZPGkdKKrLwBOYmriQjF+PqzOUXI28HDeu+v01CUaMDgtXepYXC1gAGQPp t4id8bXk6Vfk4BvL71MKxjuK355OONi0c2uJz/+VbsunE/lVqlLblpwJR1sX5pIEaZpj xeNbKdk8Hp2np0wIF+Bnqg2WVc40PW/5QH+dMUyyvLvqPkwz2IyLeulFq1M6OyIsmcYi 3RdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=Ms9C/9A0FSfh2mm0WkpMIkoUR7i908GJu9ttwY7f2Do=; fh=lUE9eyTnU5CZ+6MDp0UzjXzwNcZpdX/0uvx1B0FKpvc=; b=U4Z7ox9Kt2bBkFNg+5phKg94xUL92ss2U0YdpVhFPdeCOfrl1T23QLkYQe0UTjEV8J jq6lkThEqiQ7S1qNRMutx6QedECsjN+TGWQ681xR/XFreUG9z6i7BgCVV/WkYfDr/NFA SocXtlEIjqNG/GkvO/LGQwkzpy8kTxx39kebb9mBwwxQ5xZK0SE9JOnXBtvT6eR4SlT0 6OHiX28pHGV3Nh0VNw0NDWJr4lW9/5dWzYEkYuAxbq7rJMrKs//07YDz6ceG1n4c+bJr +wzLuMjFyVhTifswzQZxgJM+k4gsIjA3Wt9xaXUnGZf6tdVCy1yTsDVXkdll+1L3iOfw kpug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=cIQ2HGS3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kw11-20020a170902f90b00b001b54bdd6412si10849039plb.396.2023.08.02.06.37.51; Wed, 02 Aug 2023 06:38:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=cIQ2HGS3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234222AbjHBLZ5 (ORCPT + 99 others); Wed, 2 Aug 2023 07:25:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232354AbjHBLZu (ORCPT ); Wed, 2 Aug 2023 07:25:50 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58F8426A2 for ; Wed, 2 Aug 2023 04:25:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=Ms9C/9A0FSfh2mm0WkpMIkoUR7i908GJu9ttwY7f2Do=; b=cIQ2HGS3cP+XZMAtZq1Byn+y8c U6DlXjpXUogUNUSsU3Z/1ZMmPDYlKpmMaVpsqTeUfuzKfKAtuEa8fIhvGTCGikB9NwA4+OyMZP0O2 F1SjnDk9AAd/CZiynZUd/LrY33NGVtR02jhaOeD4VHdmMkUTF5iTCMJSIZTaqabUyV2Idp2V2x2eu WOMLrKY0EFewFV2acVGKDuowTdZtXhDvF5Xq+hIMucWL4URCGJ0fxBrUJ9FUby0KkdYUxQtTw9mYe dmr/LSi244V/6B2b6X+UyISaTrNIpJX1KZ6WfW0mVLGa9NsttKQ9+45uvDf0XNcOePanj4+Cxcwjx 13N4T+3w==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qR9yx-00FtnU-16; Wed, 02 Aug 2023 11:25:35 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 9D59F3001DD; Wed, 2 Aug 2023 13:25:34 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 812F52107C43B; Wed, 2 Aug 2023 13:25:34 +0200 (CEST) Message-ID: <20230802112525.564928240@infradead.org> User-Agent: quilt/0.66 Date: Wed, 02 Aug 2023 13:24:59 +0200 From: Peter Zijlstra To: yury.norov@gmail.com, andriy.shevchenko@linux.intel.com, linux@rasmusvillemoes.dk Cc: peterz@infradead.org, Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, rppt@kernel.org Subject: [PATCH 1/2] mm: Mark nr_node_ids __ro_after_init References: <20230802112458.230221601@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Just like nr_cpu_ids, nr_node_ids covers the side of possible_map and is thus constant after init. Mark the variable __ro_after_init to both improve performance and enhance security, since the variable is exported. A module writing to it would be 'unfortunate'. Signed-off-by: Peter Zijlstra (Intel) --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -305,7 +305,7 @@ int movable_zone; EXPORT_SYMBOL(movable_zone); #if MAX_NUMNODES > 1 -unsigned int nr_node_ids __read_mostly = MAX_NUMNODES; +unsigned int nr_node_ids __ro_after_init = MAX_NUMNODES; unsigned int nr_online_nodes __read_mostly = 1; EXPORT_SYMBOL(nr_node_ids); EXPORT_SYMBOL(nr_online_nodes);