[PATCH v2 1/5] rcu/kvfree: Initialize kvfree_rcu() separately

From: Uladzislau Rezki (Sony)
Date: Thu Dec 12 2024 - 13:04:44 EST


Introduce a separate initialization of kvfree_rcu() functionality.
For such purpose a kfree_rcu_batch_init() is renamed to a kvfree_rcu_init()
and it is invoked from the main.c right after rcu_init() is done.

Signed-off-by: Uladzislau Rezki (Sony) <urezki@xxxxxxxxx>
---
include/linux/rcupdate.h | 1 +
init/main.c | 1 +
kernel/rcu/tree.c | 3 +--
3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 48e5c03df1dd..acb0095b4dbe 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -118,6 +118,7 @@ static inline void call_rcu_hurry(struct rcu_head *head, rcu_callback_t func)

/* Internal to kernel */
void rcu_init(void);
+void __init kvfree_rcu_init(void);
extern int rcu_scheduler_active;
void rcu_sched_clock_irq(int user);

diff --git a/init/main.c b/init/main.c
index 00fac1170294..893cb77aef22 100644
--- a/init/main.c
+++ b/init/main.c
@@ -992,6 +992,7 @@ void start_kernel(void)
workqueue_init_early();

rcu_init();
+ kvfree_rcu_init();

/* Trace events are available after this */
trace_init();
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index ff98233d4aa5..e69b867de8ef 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -5648,7 +5648,7 @@ static void __init rcu_dump_rcu_node_tree(void)

struct workqueue_struct *rcu_gp_wq;

-static void __init kfree_rcu_batch_init(void)
+void __init kvfree_rcu_init(void)
{
int cpu;
int i, j;
@@ -5703,7 +5703,6 @@ void __init rcu_init(void)

rcu_early_boot_tests();

- kfree_rcu_batch_init();
rcu_bootup_announce();
sanitize_kthread_prio();
rcu_init_geometry();
--
2.39.5