Re: [RFC][PATCH 1/6] lockdep: annotate rcu_read_{,un}lock{,_bh}

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Paul E. McKenney
Date: Wednesday, September 19, 2007 - 4:06 pm

On Wed, Sep 19, 2007 at 12:41:26PM +0200, Peter Zijlstra wrote:

In my message yesterday, I forgot about srcu_read_lock() and
srcu_read_unlock().  :-/ Here is a proto-patch, untested,
probably does not compile.

One interesting side-effect of the overall patch is that one must select
CONFIG_PREEMPT in order for a CONFIG_DEBUG_LOCK_ALLOC build to compile.
Might be OK, but thought I should mention it.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

diff -urpNa -X dontdiff linux-2.6.22-rcudep/kernel/srcu.c linux-2.6.22-srcudep/kernel/srcu.c
--- linux-2.6.22-rcudep/kernel/srcu.c	2007-07-08 16:32:17.000000000 -0700
+++ linux-2.6.22-srcudep/kernel/srcu.c	2007-09-19 12:50:00.000000000 -0700
@@ -33,6 +33,7 @@
 #include <linux/slab.h>
 #include <linux/smp.h>
 #include <linux/srcu.h>
+#include <linux/rcupdate.h>
 
 /**
  * init_srcu_struct - initialize a sleep-RCU structure
@@ -116,6 +117,7 @@ int srcu_read_lock(struct srcu_struct *s
 	per_cpu_ptr(sp->per_cpu_ref, smp_processor_id())->c[idx]++;
 	srcu_barrier();  /* ensure compiler won't misorder critical section. */
 	preempt_enable();
+	rcu_read_acquire();
 	return idx;
 }
 
@@ -131,6 +133,7 @@ int srcu_read_lock(struct srcu_struct *s
  */
 void srcu_read_unlock(struct srcu_struct *sp, int idx)
 {
+	rcu_read_release();
 	preempt_disable();
 	srcu_barrier();  /* ensure compiler won't misorder critical section. */
 	per_cpu_ptr(sp->per_cpu_ref, smp_processor_id())->c[idx]--;

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [RFC][PATCH 1/6] lockdep: annotate rcu_read_{,un}lock{ ..., Paul E. McKenney, (Wed Sep 19, 4:06 pm)