From 64cea1499520b34df28cb25e4ae4a0c120b18115 Mon Sep 17 00:00:00 2001 From: David Howells Date: Fri, 9 Apr 2010 15:39:11 -0700 Subject: [PATCH] --- yaml --- r: 190027 b: refs/heads/master c: c08c68dd76bd6b776bc0eb45a5e8f354ed772cdf h: refs/heads/master i: 190025: 26e4a4b61f8afa316d0432a365b915006849b439 190023: a07067c0a1e73ea94b4f4fd2eccf4022b583b015 v: v3 --- [refs] | 2 +- trunk/include/linux/rcupdate.h | 28 +++++++++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 2b676349ea4c..e2081db749d7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b62730baea32f86fe91a7930e4b7ee8d82778b79 +refs/heads/master: c08c68dd76bd6b776bc0eb45a5e8f354ed772cdf diff --git a/trunk/include/linux/rcupdate.h b/trunk/include/linux/rcupdate.h index 8fe86609441f..9f1ddfef84b5 100644 --- a/trunk/include/linux/rcupdate.h +++ b/trunk/include/linux/rcupdate.h @@ -195,12 +195,30 @@ static inline int rcu_read_lock_sched_held(void) /** * rcu_dereference_check - rcu_dereference with debug checking + * @p: The pointer to read, prior to dereferencing + * @c: The conditions under which the dereference will take place * - * Do an rcu_dereference(), but check that the context is correct. - * For example, rcu_dereference_check(gp, rcu_read_lock_held()) to - * ensure that the rcu_dereference_check() executes within an RCU - * read-side critical section. It is also possible to check for - * locks being held, for example, by using lockdep_is_held(). + * Do an rcu_dereference(), but check that the conditions under which the + * dereference will take place are correct. Typically the conditions indicate + * the various locking conditions that should be held at that point. The check + * should return true if the conditions are satisfied. + * + * For example: + * + * bar = rcu_dereference_check(foo->bar, rcu_read_lock_held() || + * lockdep_is_held(&foo->lock)); + * + * could be used to indicate to lockdep that foo->bar may only be dereferenced + * if either the RCU read lock is held, or that the lock required to replace + * the bar struct at foo->bar is held. + * + * Note that the list of conditions may also include indications of when a lock + * need not be held, for example during initialisation or destruction of the + * target struct: + * + * bar = rcu_dereference_check(foo->bar, rcu_read_lock_held() || + * lockdep_is_held(&foo->lock) || + * atomic_read(&foo->usage) == 0); */ #define rcu_dereference_check(p, c) \ ({ \