From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: linux-kernel@vger.kernel.org,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: [PATCH v20 5/6] init: move percpu_counter_tree_subsystem_init() earlier in boot
Date: Tue, 7 Jul 2026 09:15:35 -0400 [thread overview]
Message-ID: <20260707131544.75906-6-mathieu.desnoyers@efficios.com> (raw)
In-Reply-To: <20260707131544.75906-1-mathieu.desnoyers@efficios.com>
Move percpu_counter_tree_subsystem_init() from after trap_init() to
immediately after setup_nr_cpu_ids() in start_kernel().
The function's only dependency is nr_cpu_ids: it calls
get_count_order(nr_cpu_ids), indexes into a const configuration table,
and performs arithmetic to derive accuracy parameters. It requires no
memory allocator, percpu areas, or other infrastructure.
Initialize the subsystem as soon as its dependency is available rather
than deferring until later in the boot sequence. This ensures
percpu_counter_tree_items_size() returns the correct value well before
its first use in mm_cache_init().
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
init/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/init/main.c b/init/main.c
index 8581ea542cde..a0701d400b0f 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1001,6 +1001,7 @@ void start_kernel(void)
setup_boot_config();
setup_command_line(command_line);
setup_nr_cpu_ids();
+ percpu_counter_tree_subsystem_init();
setup_per_cpu_areas();
smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
early_numa_node_init();
@@ -1032,7 +1033,6 @@ void start_kernel(void)
vfs_caches_init_early();
sort_main_extable();
trap_init();
- percpu_counter_tree_subsystem_init();
mm_core_init();
maple_tree_init();
poking_init();
--
2.43.0
next prev parent reply other threads:[~2026-07-07 13:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 13:15 [PATCH v20 0/6] Hierarchical Percpu Counters for RSS Mathieu Desnoyers
2026-07-07 13:15 ` [PATCH v20 1/6] lib: introduce hierarchical per-cpu counters Mathieu Desnoyers
2026-07-07 13:15 ` [PATCH v20 2/6] lib: test " Mathieu Desnoyers
2026-07-07 13:15 ` [PATCH v20 3/6] mm: improve RSS counter approximation accuracy for proc interfaces Mathieu Desnoyers
2026-07-07 13:15 ` [PATCH v20 4/6] mm: reorder mm_struct flexible array to place mm_cpumask first Mathieu Desnoyers
2026-07-07 13:15 ` Mathieu Desnoyers [this message]
2026-07-07 13:15 ` [PATCH v20 6/6] lib: inline percpu_counter_tree_items_size with boot-safety sentinel Mathieu Desnoyers
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=20260707131544.75906-6-mathieu.desnoyers@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=linux-kernel@vger.kernel.org \
/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
Powered by JetHome