diff options
author | Dipankar Sarma <dipankar@in.ibm.com> | 2004-08-22 22:58:51 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-08-22 22:58:51 -0700 |
commit | 5dae7a69a46f3a9f6562a4702f8beaa7f77e94f6 (patch) | |
tree | 40daf62eb530c10372f9cb90f600a0b040c5e725 /ipc | |
parent | 9711268caede0cbd322244d70145a6e914fac52e (diff) | |
download | history-5dae7a69a46f3a9f6562a4702f8beaa7f77e94f6.tar.gz |
[PATCH] rcu: abstracted RCU dereferencing
Use abstracted RCU API to dereference RCU protected data. Hides barrier
details. Patch from Paul McKenney.
This patch introduced an rcu_dereference() macro that replaces most uses of
smp_read_barrier_depends(). The new macro has the advantage of explicitly
documenting which pointers are protected by RCU -- in contrast, it is
sometimes difficult to figure out which pointer is being protected by a given
smp_read_barrier_depends() call.
Signed-off-by: Paul McKenney <paulmck@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/util.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/ipc/util.c b/ipc/util.c index 5fb0e451c39849..a6c797431f0620 100644 --- a/ipc/util.c +++ b/ipc/util.c @@ -100,7 +100,7 @@ int ipc_findkey(struct ipc_ids* ids, key_t key) int max_id = ids->max_id; /* - * read_barrier_depends is not needed here + * rcu_dereference() is not needed here * since ipc_ids.sem is held */ for (id = 0; id <= max_id; id++) { @@ -171,7 +171,7 @@ int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size) size = grow_ary(ids,size); /* - * read_barrier_depends() is not needed here since + * rcu_dereference()() is not needed here since * ipc_ids.sem is held */ for (id = 0; id < size; id++) { @@ -220,7 +220,7 @@ struct kern_ipc_perm* ipc_rmid(struct ipc_ids* ids, int id) BUG(); /* - * do not need a read_barrier_depends() here to force ordering + * do not need a rcu_dereference()() here to force ordering * on Alpha, since the ipc_ids.sem is held. */ p = ids->entries[lid].p; @@ -515,13 +515,12 @@ struct kern_ipc_perm* ipc_lock(struct ipc_ids* ids, int id) * Note: The following two read barriers are corresponding * to the two write barriers in grow_ary(). They guarantee * the writes are seen in the same order on the read side. - * smp_rmb() has effect on all CPUs. read_barrier_depends() + * smp_rmb() has effect on all CPUs. rcu_dereference() * is used if there are data dependency between two reads, and * has effect only on Alpha. */ smp_rmb(); /* prevent indexing old array with new size */ - entries = ids->entries; - read_barrier_depends(); /*prevent seeing new array unitialized */ + entries = rcu_dereference(ids->entries); out = entries[lid].p; if(out == NULL) { rcu_read_unlock(); |