From 5173768095d3e78890eb497064e820482de5970e Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Wed, 29 May 2013 09:06:27 +0000 Subject: [PATCH] --- yaml --- r: 376681 b: refs/heads/master c: c87a124a5d5e8cf8e21c4363c3372bcaf53ea190 h: refs/heads/master i: 376679: a7040b6d114a48c14e3b58f73233f89e23a9b0d5 v: v3 --- [refs] | 2 +- trunk/include/linux/rculist_nulls.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index bf38d53a91b0..2b82d924cd8d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c802db1164f28e62c6a43132b8d290cb8113f2ac +refs/heads/master: c87a124a5d5e8cf8e21c4363c3372bcaf53ea190 diff --git a/trunk/include/linux/rculist_nulls.h b/trunk/include/linux/rculist_nulls.h index 2ae13714828b..1c33dd7da4a7 100644 --- a/trunk/include/linux/rculist_nulls.h +++ b/trunk/include/linux/rculist_nulls.h @@ -105,9 +105,14 @@ static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n, * @head: the head for your list. * @member: the name of the hlist_nulls_node within the struct. * + * The barrier() is needed to make sure compiler doesn't cache first element [1], + * as this loop can be restarted [2] + * [1] Documentation/atomic_ops.txt around line 114 + * [2] Documentation/RCU/rculist_nulls.txt around line 146 */ #define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \ - for (pos = rcu_dereference_raw(hlist_nulls_first_rcu(head)); \ + for (({barrier();}), \ + pos = rcu_dereference_raw(hlist_nulls_first_rcu(head)); \ (!is_a_nulls(pos)) && \ ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \ pos = rcu_dereference_raw(hlist_nulls_next_rcu(pos)))