Skip to content

Commit

Permalink
idr: Apply lockdep-based diagnostics to rcu_dereference() uses
Browse files Browse the repository at this point in the history
Because idr can be used with any of a number of locks or with
any flavor of RCU, just disable the lockdep-based diagnostics.
If idr needs diagnostics, the check expression will need to be
passed into the relevant idr primitives as an additional
argument.

Signed-off-by: Paul E. McKenney <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
paulmck authored and Ingo Molnar committed Feb 25, 2010
1 parent 2676a58 commit 96be753
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/idr.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ void *idr_find(struct idr *idp, int id)
int n;
struct idr_layer *p;

p = rcu_dereference(idp->top);
p = rcu_dereference_raw(idp->top);
if (!p)
return NULL;
n = (p->layer+1) * IDR_BITS;
Expand All @@ -519,7 +519,7 @@ void *idr_find(struct idr *idp, int id)
while (n > 0 && p) {
n -= IDR_BITS;
BUG_ON(n != p->layer*IDR_BITS);
p = rcu_dereference(p->ary[(id >> n) & IDR_MASK]);
p = rcu_dereference_raw(p->ary[(id >> n) & IDR_MASK]);
}
return((void *)p);
}
Expand Down Expand Up @@ -552,15 +552,15 @@ int idr_for_each(struct idr *idp,
struct idr_layer **paa = &pa[0];

n = idp->layers * IDR_BITS;
p = rcu_dereference(idp->top);
p = rcu_dereference_raw(idp->top);
max = 1 << n;

id = 0;
while (id < max) {
while (n > 0 && p) {
n -= IDR_BITS;
*paa++ = p;
p = rcu_dereference(p->ary[(id >> n) & IDR_MASK]);
p = rcu_dereference_raw(p->ary[(id >> n) & IDR_MASK]);
}

if (p) {
Expand Down

0 comments on commit 96be753

Please sign in to comment.