[patch 1/4] kernel call_rcu usage: initialize rcu_head structures
From: Mathieu Desnoyers
Date: Tue Oct 06 2009 - 10:42:53 EST
Initialize rcu_head structures before passing them to call_rcu() to eliminate
false positives in DEBUG_RCU_HEAD.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxx>
CC: "Paul E. McKenney" <paulmck@xxxxxxxxxxxxxxxxxx>
CC: mingo@xxxxxxx
CC: akpm@xxxxxxxxxxxxxxxxxxxx
---
kernel/exit.c | 1 +
kernel/pid.c | 1 +
kernel/rcupdate.c | 1 +
3 files changed, 3 insertions(+)
Index: linux-2.6-lttng/kernel/rcupdate.c
===================================================================
--- linux-2.6-lttng.orig/kernel/rcupdate.c 2009-10-06 09:00:06.000000000 -0400
+++ linux-2.6-lttng/kernel/rcupdate.c 2009-10-06 09:01:14.000000000 -0400
@@ -92,6 +92,7 @@ void synchronize_rcu(void)
init_completion(&rcu.completion);
/* Will wake me after RCU finished. */
+ INIT_RCU_HEAD(&rcu.head);
call_rcu(&rcu.head, wakeme_after_rcu);
/* Wait for it. */
wait_for_completion(&rcu.completion);
Index: linux-2.6-lttng/kernel/exit.c
===================================================================
--- linux-2.6-lttng.orig/kernel/exit.c 2009-10-06 09:05:21.000000000 -0400
+++ linux-2.6-lttng/kernel/exit.c 2009-10-06 09:05:34.000000000 -0400
@@ -208,6 +208,7 @@ repeat:
write_unlock_irq(&tasklist_lock);
release_thread(p);
+ INIT_RCU_HEAD(&p->rcu);
call_rcu(&p->rcu, delayed_put_task_struct);
p = leader;
Index: linux-2.6-lttng/kernel/pid.c
===================================================================
--- linux-2.6-lttng.orig/kernel/pid.c 2009-10-06 09:10:59.000000000 -0400
+++ linux-2.6-lttng/kernel/pid.c 2009-10-06 09:11:43.000000000 -0400
@@ -236,6 +236,7 @@ void free_pid(struct pid *pid)
for (i = 0; i <= pid->level; i++)
free_pidmap(pid->numbers + i);
+ INIT_RCU_HEAD(&pid->rcu);
call_rcu(&pid->rcu, delayed_put_pid);
}
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/