[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1189175688.28781.167.camel@johannes.berg>
Date: Fri, 07 Sep 2007 16:34:48 +0200
From: Johannes Berg <johannes@...solutions.net>
To: linux-kernel <linux-kernel@...r.kernel.org>
Cc: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Randy Dunlap <randy.dunlap@...cle.com>,
Pavel Emelianov <xemul@...nvz.org>,
Zach Brown <zach.brown@...cle.com>,
Dave Jones <davej@...hat.com>, Oleg Nesterov <oleg@...sign.ru>
Subject: [PATCH] list.h: add list_for_each_entry_continue_rcu
To implement the multicast list callback in mac80211 we need to
do partial list iteration. Since I want to convert the interface
list to an RCU list, I need a new list walking primitive:
list_for_each_entry_continue_rcu().
Signed-off-by: Johannes Berg <johannes@...solutions.net>
Cc: linux-kernel@...r.kernel.org
Cc: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
Cc: Herbert Xu <herbert@...dor.apana.org.au>
Cc: Randy Dunlap <randy.dunlap@...cle.com>
Cc: Pavel Emelianov <xemul@...nvz.org>
Cc: Zach Brown <zach.brown@...cle.com>
Cc: Dave Jones <davej@...hat.com>
Cc: Oleg Nesterov <oleg@...sign.ru>
---
How do we want to handle this? Is it ok to push this via net-2.6.24 so
we can merge it along with the fix that needs it?
include/linux/list.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
--- wireless-dev.orig/include/linux/list.h 2007-09-07 00:16:07.374444290 +0200
+++ wireless-dev/include/linux/list.h 2007-08-29 21:08:14.802054000 +0200
@@ -665,6 +665,26 @@ static inline void list_splice_init_rcu(
prefetch(rcu_dereference((pos))->next), (pos) != (head); \
(pos) = (pos)->next)
+
+/**
+ * list_for_each_entry_continue_rcu - continue iteration over rcu list
+ * @pos: the type * to use as a loop cursor.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Continue to iterate over rcu list of given type, continuing after
+ * the current position.
+ *
+ * This list-traversal primitive may safely run concurrently with
+ * the _rcu list-mutation primitives such as list_add_rcu()
+ * as long as the traversal is guarded by rcu_read_lock().
+ */
+#define list_for_each_entry_continue_rcu(pos, head, member) \
+ for ((pos) = list_entry((pos)->member.next, typeof(*pos), member); \
+ prefetch(rcu_dereference((pos))->member.next), \
+ &pos->member != (head); \
+ (pos) = list_entry(pos->member.next, typeof(*pos), member))
+
/*
* Double linked lists with a single pointer list head.
* Mostly useful for hash tables where the two pointer list head is
-
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