From: Nadia.Derbey@bull.net
To: efault@gmx.de
Cc: manfred@colorfullife.com, linux-kernel@vger.kernel.org,
paulmck@linux.vnet.ibm.com, akpm@linux-foundation.org,
peterz@infradead.org, xemul@openvz.org,
Nadia Derbey <Nadia.Derbey@bull.net>
Subject: [PATCH 02/13] Change ridr structure
Date: Fri, 11 Apr 2008 18:17:04 +0200 [thread overview]
Message-ID: <20080411161957.931693000@bull.net> (raw)
In-Reply-To: <20080411161702.460410000@bull.net>
[-- Attachment #1: change_ridr_struct.patch --]
[-- Type: text/plain, Size: 2519 bytes --]
[PATCH 02/13]
This patch changes the ridr structures to make them use RCU.
Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net>
---
include/linux/ridr.h | 42 +++++++++++++++++++++++++++---------------
1 file changed, 27 insertions(+), 15 deletions(-)
Index: linux-2.6.25-rc8-mm1/include/linux/ridr.h
===================================================================
--- linux-2.6.25-rc8-mm1.orig/include/linux/ridr.h 2008-04-11 17:17:41.000000000 +0200
+++ linux-2.6.25-rc8-mm1/include/linux/ridr.h 2008-04-11 17:34:35.000000000 +0200
@@ -9,41 +9,53 @@
#define _RIDR_H_
#include <linux/idr.h>
+#include <linux/rcupdate.h>
struct ridr_layer {
unsigned long bitmap; /* A zero bit means "space here" */
struct ridr_layer *ary[1<<IDR_BITS];
int count; /* When zero, we can release it */
+ struct rcu_head rcu_head;
};
struct ridr {
- struct ridr_layer *top;
- struct ridr_layer *id_free;
int layers;
- int id_free_cnt;
- spinlock_t lock;
+ gfp_t gfp_mask;
+ struct ridr_layer *top;
};
-#define RIDR_INIT(name) \
+#define RIDR_INIT(mask) \
{ \
- .top = NULL, \
- .id_free = NULL, \
.layers = 0, \
- .id_free_cnt = 0, \
- .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
+ .gfp_mask = (mask), \
+ .top = NULL, \
}
-#define DEFINE_RIDR(name) struct ridr name = RIDR_INIT(name)
+#define DEFINE_RIDR(name, mask) struct ridr name = RIDR_INIT(mask)
-#define INIT_RIDR(name) \
+#define INIT_RIDR(name, mask) \
do { \
- (name)->top = NULL; \
- (name)->id_free = NULL; \
(name)->layers = 0; \
- (name)->id_free_cnt = 0; \
- (name)->lock = __SPIN_LOCK_UNLOCKED(name.lock); \
+ (name)->gfp_mask = (mask); \
+ (name)->top = NULL; \
} while (0)
+/**
+ * Ridr synchronization (see radix-tree.h)
+ *
+ * ridr_find() is able to be called locklessly, using RCU. The caller must
+ * ensure calls to this function are made within rcu_read_lock() regions.
+ * Other readers (lock-free or otherwise) and modifications may be running
+ * concurrently.
+ *
+ * It is still required that the caller manage the synchronization and
+ * lifetimes of the items. So if RCU lock-free lookups are used, typically
+ * this would mean that the items have their own locks, or are amenable to
+ * lock-free access; and that the items are freed by RCU (or only freed after
+ * having been deleted from the ridr tree *and* a synchronize_rcu() grace
+ * period).
+ */
+
/*
* This is what we export.
*/
--
next prev parent reply other threads:[~2008-04-11 16:21 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-11 16:17 [PATCH 00/13] Re: Scalability requirements for sysv ipc Nadia.Derbey
2008-04-11 16:17 ` [PATCH 01/13] duplicate idr code Nadia.Derbey
2008-04-11 16:17 ` Nadia.Derbey [this message]
2008-04-11 16:17 ` [PATCH 03/13] Fix ridr_pre_get() Nadia.Derbey
2008-04-11 16:17 ` [PATCH 04/13] Fix ridr_alloc_layer() Nadia.Derbey
2008-04-11 16:17 ` [PATCH 05/13] Fix free_layer() Nadia.Derbey
2008-04-11 16:17 ` [PATCH 06/13] Fix sub_alloc() Nadia.Derbey
2008-04-11 16:17 ` [PATCH 07/13] Fix get_empty_slot() Nadia.Derbey
2008-04-11 16:17 ` [PATCH 08/13] Fix ridr_get_new_above_int() Nadia.Derbey
2008-04-11 16:17 ` [PATCH 09/13] Fix ridr_remove() Nadia.Derbey
2008-04-11 16:17 ` [PATCH 10/13] Fix ridr_find() Nadia.Derbey
2008-04-11 16:17 ` [PATCH 11/13] Integrate the ridr code Nadia.Derbey
2008-04-11 16:17 ` [PATCH 12/13] Integrate the ridr code into IPC code Nadia.Derbey
2008-04-11 16:17 ` [PATCH 13/13] Get rid of ipc_lock_down() Nadia.Derbey
2008-04-11 16:27 ` [PATCH 00/13] Re: Scalability requirements for sysv ipc Peter Zijlstra
2008-04-14 5:18 ` Nadia Derbey
2008-04-14 7:15 ` Peter Zijlstra
2008-04-14 8:33 ` Nadia Derbey
2008-04-14 10:52 ` Nadia Derbey
2008-04-14 18:54 ` Manfred Spraul
2008-04-15 6:13 ` Nadia Derbey
2008-04-19 23:28 ` Paul E. McKenney
2008-04-21 8:07 ` Nadia Derbey
2008-04-21 14:44 ` Paul E. McKenney
2008-04-14 13:54 ` Mike Galbraith
2008-04-14 15:01 ` Nadia Derbey
2008-04-19 23:24 ` Paul E. McKenney
2008-04-19 23:25 ` Paul E. McKenney
2008-04-21 5:59 ` Nadia Derbey
2008-04-29 14:35 ` Nadia Derbey
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=20080411161957.931693000@bull.net \
--to=nadia.derbey@bull.net \
--cc=akpm@linux-foundation.org \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=xemul@openvz.org \
/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
all inboxes | Powered by JetHome®