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
Date: Wed, 02 Aug 2023 13:24:59 +0200 [thread overview]
Message-ID: <20230802112525.564928240@infradead.org> (raw)
In-Reply-To: <20230802112458.230221601@infradead.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) <peterz@infradead.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);
next prev parent reply other threads:[~2023-08-02 11:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-02 11:24 [PATCH 0/2] nodemask: Use nr_node_ids Peter Zijlstra
2023-08-02 11:24 ` Peter Zijlstra [this message]
2023-08-02 14:58 ` [PATCH 1/2] mm: Mark nr_node_ids __ro_after_init Mike Rapoport
2023-08-02 11:25 ` [PATCH 2/2] mm,nodemask: Use nr_node_ids Peter Zijlstra
2023-08-02 15:32 ` Mike Rapoport
2023-08-02 15:48 ` Peter Zijlstra
2023-08-02 19:36 ` [PATCH v2 " Peter Zijlstra
2023-08-03 0:45 ` Yury Norov
2023-08-03 8:41 ` Peter Zijlstra
2023-08-03 20:41 ` Yury Norov
2023-08-03 21:00 ` Yury Norov
2023-08-04 8:14 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230802112525.564928240@infradead.org \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@rasmusvillemoes.dk \
--cc=rppt@kernel.org \
--cc=tglx@linutronix.de \
--cc=yury.norov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox