Skip to content

Commit f34c858

Browse files
committed
rcutorture: Invoke call_rcu() from timer handler
The Linux kernel invokes call_rcu() from various interrupt/softirq handlers, but rcutorture does not. This commit therefore adds this behavior to rcutorture's repertoire. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
1 parent 96036c4 commit f34c858

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎kernel/rcu/rcutorture.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,11 @@ rcu_torture_fakewriter(void *arg)
10801080
return 0;
10811081
}
10821082

1083+
static void rcu_torture_timer_cb(struct rcu_head *rhp)
1084+
{
1085+
kfree(rhp);
1086+
}
1087+
10831088
/*
10841089
* RCU torture reader from timer handler. Dereferences rcu_torture_current,
10851090
* incrementing the corresponding element of the pipeline array. The
@@ -1142,6 +1147,14 @@ static void rcu_torture_timer(unsigned long unused)
11421147
__this_cpu_inc(rcu_torture_batch[completed]);
11431148
preempt_enable();
11441149
cur_ops->readunlock(idx);
1150+
1151+
/* Test call_rcu() invocation from interrupt handler. */
1152+
if (cur_ops->call) {
1153+
struct rcu_head *rhp = kmalloc(sizeof(*rhp), GFP_NOWAIT);
1154+
1155+
if (rhp)
1156+
cur_ops->call(rhp, rcu_torture_timer_cb);
1157+
}
11451158
}
11461159

11471160
/*

0 commit comments

Comments
 (0)