Re: [PATCH] add b+tree library

From: Andrew Morton
Date: Sat Jan 10 2009 - 17:25:00 EST


On Sat, 10 Jan 2009 23:01:35 +0100 J__rn Engel <joern@xxxxxxxxx> wrote:

> One key difference is that rbtrees maintain the tree within objects and
> btrees maintain the tree externally. So btrees have to allocate memory
> on insertion, where rbtrees have the necessary memory as part of the
> object.

This is a major disadvantage of the btrees.

See all the hoops we ended up jumping through with things like
radix_tree_preload() and idr_pre_get().

The IDR code there wasn't very well designed and still has holes. The
radix-tree code afaik is solid, but look at all the stuff it does!

> With mempools the memory allocation should be reasonably safe,
> so maybe this is a bit of a red herring now.

No, mempools won't help, particularly if items are being added from
atomic contexts.

This is a major major shortcoming which greatly limits the usefulness
of btrees and which greatly reduces the chances of anyone migrating any
rbtree users over to btrees.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/