Explorar el Código

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>
Paul E. McKenney hace 8 años
padre
commit
f34c8585ed
Se han modificado 1 ficheros con 13 adiciones y 0 borrados
  1. 13 0
      kernel/rcu/rcutorture.c

+ 13 - 0
kernel/rcu/rcutorture.c

@@ -1080,6 +1080,11 @@ rcu_torture_fakewriter(void *arg)
 	return 0;
 	return 0;
 }
 }
 
 
+static void rcu_torture_timer_cb(struct rcu_head *rhp)
+{
+	kfree(rhp);
+}
+
 /*
 /*
  * RCU torture reader from timer handler.  Dereferences rcu_torture_current,
  * RCU torture reader from timer handler.  Dereferences rcu_torture_current,
  * incrementing the corresponding element of the pipeline array.  The
  * incrementing the corresponding element of the pipeline array.  The
@@ -1142,6 +1147,14 @@ static void rcu_torture_timer(unsigned long unused)
 	__this_cpu_inc(rcu_torture_batch[completed]);
 	__this_cpu_inc(rcu_torture_batch[completed]);
 	preempt_enable();
 	preempt_enable();
 	cur_ops->readunlock(idx);
 	cur_ops->readunlock(idx);
+
+	/* Test call_rcu() invocation from interrupt handler. */
+	if (cur_ops->call) {
+		struct rcu_head *rhp = kmalloc(sizeof(*rhp), GFP_NOWAIT);
+
+		if (rhp)
+			cur_ops->call(rhp, rcu_torture_timer_cb);
+	}
 }
 }
 
 
 /*
 /*