Skip to content

Commit c8fa637

Browse files
committed
rcutorture: Properly set rcu_fwds for OOM handling
The conversion of rcu_fwds to dynamic allocation failed to actually allocate the required structure. This commit therefore allocates it, frees it, and updates rcu_fwds accordingly. While in the area, it abstracts the cleanup actions into rcu_torture_fwd_prog_cleanup(). Fixes: 5155be9 ("rcutorture: Dynamically allocate rcu_fwds structure") Reported-by: kernel test robot <rong.a.chen@intel.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
1 parent 5461808 commit c8fa637

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

kernel/rcu/rcutorture.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2148,9 +2148,20 @@ static int __init rcu_torture_fwd_prog_init(void)
21482148
return -ENOMEM;
21492149
spin_lock_init(&rfp->rcu_fwd_lock);
21502150
rfp->rcu_fwd_cb_tail = &rfp->rcu_fwd_cb_head;
2151+
rcu_fwds = rfp;
21512152
return torture_create_kthread(rcu_torture_fwd_prog, rfp, fwd_prog_task);
21522153
}
21532154

2155+
static void rcu_torture_fwd_prog_cleanup(void)
2156+
{
2157+
struct rcu_fwd *rfp;
2158+
2159+
torture_stop_kthread(rcu_torture_fwd_prog, fwd_prog_task);
2160+
rfp = rcu_fwds;
2161+
rcu_fwds = NULL;
2162+
kfree(rfp);
2163+
}
2164+
21542165
/* Callback function for RCU barrier testing. */
21552166
static void rcu_torture_barrier_cbf(struct rcu_head *rcu)
21562167
{
@@ -2448,7 +2459,7 @@ rcu_torture_cleanup(void)
24482459
show_rcu_gp_kthreads();
24492460
rcu_torture_read_exit_cleanup();
24502461
rcu_torture_barrier_cleanup();
2451-
torture_stop_kthread(rcu_torture_fwd_prog, fwd_prog_task);
2462+
rcu_torture_fwd_prog_cleanup();
24522463
torture_stop_kthread(rcu_torture_stall, stall_task);
24532464
torture_stop_kthread(rcu_torture_writer, writer_task);
24542465

0 commit comments

Comments
 (0)