The patch titled add rcu_assign_index() if ever needed has been added to the -mm tree. Its filename is add-rcu_assign_index-if-ever-needed.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: add rcu_assign_index() if ever needed From: "Paul E. McKenney" <paulmck@xxxxxxxxxxxxxxxxxx> This is a speculative patch that as far as I can tell is not yet required. If anyone applies RCU to a data structure allocated out of an array, using array indexes in place of pointers to link the array elements together, then the rcu_assign_index() function in this patch will be needed to assign a given element's array index to the RCU-traversed index. The implementation is exactly that of the old rcu_assign_pointer(), so is extremely well tested. The existing rcu_assign_pointer() will emit a compiler warning in cases where rcu_assign_index() is required. Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/rcupdate.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff -puN include/linux/rcupdate.h~add-rcu_assign_index-if-ever-needed include/linux/rcupdate.h --- a/include/linux/rcupdate.h~add-rcu_assign_index-if-ever-needed +++ a/include/linux/rcupdate.h @@ -188,6 +188,24 @@ struct rcu_head { }) /** + * rcu_assign_index - assign (publicize) a index of a newly + * initialized array elementg that will be dereferenced by RCU + * read-side critical sections. Returns the value assigned. + * + * Inserts memory barriers on architectures that require them + * (pretty much all of them other than x86), and also prevents + * the compiler from reordering the code that initializes the + * structure after the index assignment. More importantly, this + * call documents which indexes will be dereferenced by RCU read-side + * code. + */ + +#define rcu_assign_index(p, v) ({ \ + smp_wmb(); \ + (p) = (v); \ + }) + +/** * synchronize_sched - block until all CPUs have exited any non-preemptive * kernel code sequences. * _ Patches currently in -mm which might be from paulmck@xxxxxxxxxxxxxxxxxx are rcupdate-fix-comment.patch remove-rcu_assign_pointernull-penalty-with-type-macro-safety.patch add-rcu_assign_index-if-ever-needed.patch git-sched.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html