From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: "Jörn Engel" <joern@logfs.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Theodore Tso <tytso@mit.edu>, Andi Kleen <andi@firstfloor.org>,
Johannes Berg <johannes@sipsolutions.net>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] add b+tree library
Date: Mon, 12 Jan 2009 08:20:32 -0800 [thread overview]
Message-ID: <20090112162032.GB6744@linux.vnet.ibm.com> (raw)
In-Reply-To: <20090111083034.GB30090@logfs.org>
On Sun, Jan 11, 2009 at 09:30:34AM +0100, Jörn Engel wrote:
> On Sun, 11 January 2009 00:57:20 +0100, Peter Zijlstra wrote:
> >
> > B-tree's however have one thing over RB-trees, B-trees can be made
> > RCU-safe whereas RB-trees cannot be -- the only problem is that Joern's
> > doesn't do that.
>
> And yours doesn't support multiple key sizes afaics. I don't mind
> using your version as a basis, so long as my^Wboth requirements get
> fulfilled. ;)
>
> Do you see a problem combining rcu with keys being an array of unsigned
> long?
There is a theory vs. practice issue here. In theory, you could make any
dynamically allocated search structure RCU-searchable by copy-updating
the entire structure on each update. In many cases, you only have to
replace a fairly small part. In practice, the question is whether your
read-to-update ratio is large enough to make it a win.
The main potential issue with keys being an array of unsigned long is
that it is no longer possible to atomically rewrite a given key in place.
The usual ways to work around this are:
1. Replace each key entry with a pointer to the array of unsigned
longs, so that you can atomically rewrite the pointer. The
downside of this approach is the extra cache line accessed per
key scanned. The upside of this approach is that you might
be able to share code with Peter's tree by using a comparison
function (if NULL, just compare the entries directly) or some
other similar trick.
2. Place the array of unsigned longs directly in the structure, but
copy-update the entire node rather than rewriting keys in place.
This has better cache locality, but makes it more difficult to
share code with the small-key variant.
There are probably other tricks as well.
Thanx, Paul
next prev parent reply other threads:[~2009-01-12 16:20 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-10 10:47 [PATCH] add b+tree library Johannes Berg
2009-01-10 11:02 ` KOSAKI Motohiro
2009-01-10 11:37 ` Johannes Berg
2009-01-10 11:56 ` Jörn Engel
2009-01-10 12:29 ` KOSAKI Motohiro
2009-01-10 18:39 ` Jörn Engel
2009-01-10 18:44 ` Johannes Berg
2009-01-10 19:41 ` Andi Kleen
2009-01-10 20:22 ` Johannes Berg
2009-01-10 20:23 ` Jörn Engel
2009-01-10 21:27 ` Theodore Tso
2009-01-10 22:01 ` Jörn Engel
2009-01-10 22:23 ` Andrew Morton
2009-01-10 23:57 ` Peter Zijlstra
2009-01-11 8:30 ` Jörn Engel
2009-01-12 16:20 ` Paul E. McKenney [this message]
2009-02-05 0:17 ` Johannes Berg
2009-02-05 8:46 ` Andi Kleen
2009-02-07 12:26 ` Jörn Engel
2009-01-11 3:13 ` Theodore Tso
2009-01-10 22:26 ` Andi Kleen
2009-01-11 8:20 ` Jörn Engel
2009-01-11 18:23 ` Andi Kleen
2009-01-17 17:53 ` Pavel Machek
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=20090112162032.GB6744@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=joern@logfs.org \
--cc=johannes@sipsolutions.net \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tytso@mit.edu \
/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