Re: rbtree scores (was Re: [patch] deadline-ioscheduler rb-tree sort)

From: Jens Axboe (axboe@suse.de)
Date: Sat Nov 02 2002 - 03:59:47 EST


On Fri, Nov 01 2002, Jamie Lokier wrote:
> Andrew Morton wrote:
> > Jens Axboe wrote:
> > >
> > > As expected, the stock version O(N) insertion scan really hurts. Even
> > > with 128 requests per list, rbtree version is far superior. Once bigger
> > > lists are used, there's just no comparison whatsoever.
> > >
> >
> > Jens, the tree just makes sense.
>
> Just a few comments about data structures - not important.
>
> Technically I think that a priority queue, i.e. a heap (partially
> ordered tree) is sufficient for the request queue. I don't know the
> request queue code well enough to be sure, though.

I looked into that as well, and I do have a generic binomial heap
implementation that I plan on test as well.

> If it was worth it (I suspect not), you can make a data structure
> which has O(1) amortised insertion time for a number of common cases,
> such as runs of ascending block numbers. Seems a likely pattern for a
> filesystem...

Fibonacci heaps, for instance. I looked into that as well. However, it's
actually more important to have (if possible) O(1) extraction than
insert. Extraction is typically run from interrupt context, when a
driver wants to requeue more requests because it has completed one (or
some). That was a worry with the rbtree solution. The linked list may
have had sucky O(N) insert, but extraction was a nice O(1). So far I
haven't been able to notice any regression in this area, regardless.

> Implementing the latter would likely be a lot of work for little gain
> though.

Indeed

-- 
Jens Axboe

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Nov 07 2002 - 22:00:23 EST