[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250911031811.681694-1-kaushlendra.kumar@intel.com>
Date: Thu, 11 Sep 2025 08:48:11 +0530
From: Kaushlendra Kumar <kaushlendra.kumar@...el.com>
To: dave@...olabs.net,
paulmck@...nel.org,
josh@...htriplett.org,
frederic@...nel.org,
neeraj.upadhyay@...nel.org,
rostedt@...dmis.org
Cc: linux-kernel@...r.kernel.org,
rcu@...r.kernel.org,
Kaushlendra Kumar <kaushlendra.kumar@...el.com>
Subject: [PATCH] refperf: Set reader_tasks to NULL after kfree()
Set reader_tasks to NULL after kfree() in ref_scale_cleanup() to
improve debugging experience with kernel debugging tools. This
follows the common pattern of NULLing pointers after freeing to
avoid dangling pointer issues during debugging sessions.
Setting pointers to NULL after freeing helps debugging tools like
kdgb,drgn, and other kernel debuggers by providing clear indication
that the memory has been freed and the pointer is no longer valid.
Suggested-by: Paul E. McKenney <paulmck@...nel.org>
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@...el.com>
---
kernel/rcu/refscale.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
index 2bfa987f4ba9..47486dff43ca 100644
--- a/kernel/rcu/refscale.c
+++ b/kernel/rcu/refscale.c
@@ -1048,6 +1048,7 @@ ref_scale_cleanup(void)
reader_tasks[i].task);
}
kfree(reader_tasks);
+ reader_tasks = NULL;
torture_stop_kthread("main_task", main_task);
--
2.34.1
Powered by blists - more mailing lists