Message ID | 20230802112525.564928240@infradead.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp399287vqx; Wed, 2 Aug 2023 04:59:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlF4H/LfIn56vYiW+WbY7HnsttXnE+1T0r8qO21LWlG69lgT9y+N9fEtsiOsv6I1xW+kdO+w X-Received: by 2002:a2e:8553:0:b0:2b6:b6c4:6e79 with SMTP id u19-20020a2e8553000000b002b6b6c46e79mr4602347ljj.1.1690977564736; Wed, 02 Aug 2023 04:59:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690977564; cv=none; d=google.com; s=arc-20160816; b=FoQKMZgo1XWNChN5IUm20Br+e7tY/36l2/hjOp9dEtcUcsF4pNU6wcAuBuOLX4J7SY rK6loIs1uQ/DJ7yQ602e4IB/wpwQ6FYpFLNDuOsPAubjP8bQDvHfrFGxYr1xHwZL3Ryp l9rkItw08plELiOlALUahciGFjQZgELh3VKLDQGwfgGovxvVFhIkKgu34lRbQQTZ6tKV mL5n/gpcWYMOfp9BTpVFo/c27ypJ1M9y5rUw+mowk1WhNj/m5cP4oHhf1HJeDHs6ja/J zw1vmZzKJ1+fNmjMc8UUs3Rtxn2iH1rKAPgSiDte6V3LN5XOT3APJrSv2Ki9o9mBRpE/ 7MfQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v23-20020a1709063bd700b009827e07cca6si1460275ejf.17.2023.08.02.04.59.00; Wed, 02 Aug 2023 04:59:24 -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 S234224AbjHBLZ5 (ORCPT <rfc822;maxi.paulin@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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 <peterz@infradead.org> To: yury.norov@gmail.com, andriy.shevchenko@linux.intel.com, linux@rasmusvillemoes.dk Cc: peterz@infradead.org, Andrew Morton <akpm@linux-foundation.org>, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773118491040416231 X-GMAIL-MSGID: 1773118491040416231 |
Series |
nodemask: Use nr_node_ids
|
|
Commit Message
Peter Zijlstra
Aug. 2, 2023, 11:24 a.m. UTC
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) <peterz@infradead.org>
---
mm/page_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Wed, Aug 02, 2023 at 01:24:59PM +0200, Peter Zijlstra wrote: > 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) <peterz@infradead.org> Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org> > --- > 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); > >
--- 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);