From: Johannes Berg <johannes@sipsolutions.net>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Randy Dunlap <randy.dunlap@oracle.com>,
Pavel Emelianov <xemul@openvz.org>,
Zach Brown <zach.brown@oracle.com>, Dave Jones <davej@redhat.com>,
Oleg Nesterov <oleg@tv-sign.ru>
Subject: [PATCH] list.h: add list_for_each_entry_continue_rcu
Date: Fri, 07 Sep 2007 16:34:48 +0200 [thread overview]
Message-ID: <1189175688.28781.167.camel@johannes.berg> (raw)
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@sipsolutions.net>
Cc: linux-kernel@vger.kernel.org
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Pavel Emelianov <xemul@openvz.org>
Cc: Zach Brown <zach.brown@oracle.com>
Cc: Dave Jones <davej@redhat.com>
Cc: Oleg Nesterov <oleg@tv-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
next reply other threads:[~2007-09-07 14:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-07 14:34 Johannes Berg [this message]
2007-09-07 15:34 ` Paul E. McKenney
2007-09-07 19:09 ` Johannes Berg
2007-09-07 19:57 ` Paul E. McKenney
2007-09-07 20:04 ` Johannes Berg
2007-09-10 12:05 Johannes Berg
2007-09-10 17:39 ` Paul E. McKenney
2007-09-14 21:14 ` Johannes Berg
2007-09-14 21:52 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1189175688.28781.167.camel@johannes.berg \
--to=johannes@sipsolutions.net \
--cc=davej@redhat.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@tv-sign.ru \
--cc=paulmck@linux.vnet.ibm.com \
--cc=randy.dunlap@oracle.com \
--cc=xemul@openvz.org \
--cc=zach.brown@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome