[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1311793825-31933-8-git-send-email-schnhrr@cs.tu-berlin.de>
Date: Wed, 27 Jul 2011 21:10:24 +0200
From: Jan H. Schönherr <schnhrr@...tu-berlin.de>
To: Ingo Molnar <mingo@...e.hu>, Peter Zijlstra <peterz@...radead.org>
Cc: Paul Turner <pjt@...gle.com>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Dipankar Sarma <dipankar@...ibm.com>,
linux-kernel@...r.kernel.org,
Jan H. Schönherr <schnhrr@...tu-berlin.de>
Subject: [PATCH RFCv2 7/8] rcu: Make use of __list_link() and __list_link_rcu()
From: Jan H. Schönherr <schnhrr@...tu-berlin.de>
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@...tu-berlin.de>
---
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists