* - add-an-rcu-version-of-list-splicing.patch removed from -mm tree
@ 2007-02-12 6:57 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2007-02-12 6:57 UTC (permalink / raw)
To: minyard, paulmck, mm-commits
The patch titled
add an RCU version of list splicing
has been removed from the -mm tree. Its filename was
add-an-rcu-version-of-list-splicing.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
Subject: add an RCU version of list splicing
From: Corey Minyard <minyard@acm.org>
This patch is in support of the IPMI driver. I have tested this with the
IPMI driver changes coming in the next patch.
Add a list_splice_init_rcu() function to splice an RCU-protected list into
another list. This takes the sync function as an argument, so one would do
something like:
INIT_LIST_HEAD(&list);
list_splice_init_rcu(&source, &dest, synchronize_rcu);
The idea being to keep the RCU API proliferation down to a dull roar.
[akpm@osdl.org: build fix]
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Corey Minyard <minyard@acm.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/list.h | 56 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff -puN include/linux/list.h~add-an-rcu-version-of-list-splicing include/linux/list.h
--- a/include/linux/list.h~add-an-rcu-version-of-list-splicing
+++ a/include/linux/list.h
@@ -360,6 +360,62 @@ static inline void list_splice_init(stru
}
/**
+ * list_splice_init_rcu - splice an RCU-protected list into an existing list.
+ * @list: the RCU-protected list to splice
+ * @head: the place in the list to splice the first list into
+ * @sync: function to sync: synchronize_rcu(), synchronize_sched(), ...
+ *
+ * @head can be RCU-read traversed concurrently with this function.
+ *
+ * Note that this function blocks.
+ *
+ * Important note: the caller must take whatever action is necessary to
+ * prevent any other updates to @head. In principle, it is possible
+ * to modify the list as soon as sync() begins execution.
+ * If this sort of thing becomes necessary, an alternative version
+ * based on call_rcu() could be created. But only if -really-
+ * needed -- there is no shortage of RCU API members.
+ */
+static inline void list_splice_init_rcu(struct list_head *list,
+ struct list_head *head,
+ void (*sync)(void))
+{
+ struct list_head *first = list->next;
+ struct list_head *last = list->prev;
+ struct list_head *at = head->next;
+
+ if (list_empty(head))
+ return;
+
+ /* "first" and "last" tracking list, so initialize it. */
+
+ INIT_LIST_HEAD(list);
+
+ /*
+ * At this point, the list body still points to the source list.
+ * Wait for any readers to finish using the list before splicing
+ * the list body into the new list. Any new readers will see
+ * an empty list.
+ */
+
+ sync();
+
+ /*
+ * Readers are finished with the source list, so perform splice.
+ * The order is important if the new list is global and accessible
+ * to concurrent RCU readers. Note that RCU readers are not
+ * permitted to traverse the prev pointers without excluding
+ * this function.
+ */
+
+ last->next = at;
+ smp_wmb();
+ head->next = first;
+ first->prev = head;
+ at->prev = last;
+}
+
+/**
* list_entry - get the struct for this entry
* @ptr: the &struct list_head pointer.
* @type: the type of the struct this is embedded in.
_
Patches currently in -mm which might be from minyard@acm.org are
origin.patch
add-an-rcu-version-of-list-splicing.patch
sysctl-ipmi-remove-unnecessary-insert_at_head-flag.patch
sysctl-remove-insert_at_head-from-register_sysctl.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-02-12 7:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-12 6:57 - add-an-rcu-version-of-list-splicing.patch removed from -mm tree akpm
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.