Skip to content

Commit 1441edd

Browse files
kaushlenpaulmckrcu
authored andcommitted
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@kernel.org> Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
1 parent fb7855a commit 1441edd

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

kernel/rcu/refscale.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,7 @@ ref_scale_cleanup(void)
11331133
reader_tasks[i].task);
11341134
}
11351135
kfree(reader_tasks);
1136+
reader_tasks = NULL;
11361137

11371138
torture_stop_kthread("main_task", main_task);
11381139

0 commit comments

Comments
 (0)