diff mbox series

[2/4] rcu/kvfree: Add a switcher for dynamic rcu_head

Message ID 20240828110929.3713-2-urezki@gmail.com (mailing list archive)
State New
Headers show
Series [1/4] rcu/kvfree: Support dynamic rcu_head for single argument objects | expand

Commit Message

Uladzislau Rezki Aug. 28, 2024, 11:09 a.m. UTC
Add a sysfs attribute to control whether a dynamically
rcu_head should be attached or not. It can be controlled
via "/sys/module/rcutree/parameters/use_dyn_rcu_head".

By default it is OFF.

Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
---
 kernel/rcu/tree.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 0124411fecfb..893ee69d4a4b 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -206,6 +206,9 @@  module_param(rcu_min_cached_objs, int, 0444);
 static int rcu_delay_page_cache_fill_msec = 5000;
 module_param(rcu_delay_page_cache_fill_msec, int, 0444);
 
+static bool use_dyn_rcu_head __read_mostly;
+module_param(use_dyn_rcu_head, bool, 0444);
+
 /* Retrieve RCU kthreads priority for rcutorture */
 int rcu_get_gp_kthreads_prio(void)
 {
@@ -3814,6 +3817,9 @@  attach_rcu_head_to_object(void *obj)
 {
 	struct dyn_rcu_head *rhp;
 
+	if (!use_dyn_rcu_head)
+		return NULL;
+
 	rhp = kmalloc(sizeof(struct dyn_rcu_head), GFP_KERNEL |
 		__GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN);