[PATCH RFCv2 7/8] rcu: Make use of __list_link() and __list_link_rcu()

From: Jan H. SchÃnherr
Date: Wed Jul 27 2011 - 15:13:00 EST


From: Jan H. SchÃnherr <schnhrr@xxxxxxxxxxxxxxx>

This commit rewrites __list_add_rcu() and list_replace_rcu() to make
use of the new __list_link*() functions improving the readability
of the code.

Compared to the previous code, the assignments of the prev-pointers and
the call to rcu_assign_pointer() are reordered. But this is not a
problem, as readers are forbidden to use the prev-pointers.

Signed-off-by: Jan H. SchÃnherr <schnhrr@xxxxxxxxxxxxxxx>
---
include/linux/rculist.h | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 445c4f2..c5db505 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -56,10 +56,8 @@ static inline void __list_link_rcu(struct list_head *prev,
static inline void __list_add_rcu(struct list_head *new,
struct list_head *prev, struct list_head *next)
{
- new->next = next;
- new->prev = prev;
- rcu_assign_pointer(list_next_rcu(prev), new);
- next->prev = new;
+ __list_link(new, next);
+ __list_link_rcu(prev, new);
}

/**
@@ -174,10 +172,8 @@ static inline void hlist_del_init_rcu(struct hlist_node *n)
static inline void list_replace_rcu(struct list_head *old,
struct list_head *new)
{
- new->next = old->next;
- new->prev = old->prev;
- rcu_assign_pointer(list_next_rcu(new->prev), new);
- new->next->prev = new;
+ __list_link(new, old->next);
+ __list_link_rcu(old->prev, new);
old->prev = LIST_POISON2;
}

--
1.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/