From: Andi Kleen <andi@firstfloor.org>
To: Con Kolivas <kernel@kolivas.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: BFS cpu scheduler and skip list implementation
Date: Fri, 23 Sep 2011 18:21:06 -0700 [thread overview]
Message-ID: <m28vpeka65.fsf@firstfloor.org> (raw)
In-Reply-To: <201109240945.58879.kernel@kolivas.org> (Con Kolivas's message of "Sat, 24 Sep 2011 09:45:58 +1000")
Con Kolivas <kernel@kolivas.org> writes:
> Many of you may know about Skip lists as an alternative to balanced binary
> search trees. They feature O(log n) insertion, lookup and removal of table
> entries. Anyway I've been looking for some time at the O(n) lookup of BFS
> (which is O(1) insertion and removal) to try and find a solution that didn't
> cost us at the desktop level since O(n) of small numbers of n is very fast.
> The problem is of course at higher numbers of n (or server type loads), where
> it gets linearly slower, and the cache trashing aspect of scanning linked
> lists becomes expensive.
The big problem with skiplists is that it is hard to resize the pointer
arrays: so you either waste a lot of memory/cache or you have a highest
limit after which they start performing poorly.
I investigated them some time ago to replace the non scalable rbtrees
we have currently, but got discouraged by these problems.
> +struct nodeStructure {
> + int level; /* Levels in this structure */
> + keyType key;
> + valueType value;
> + skiplist_node *next[16];
> + skiplist_node *prev[16];
> +};
That's 128 byte / 2 cache lines, not too bad, but it limits
the maximum number of tasks that can be efficiently handled
(my guess to around 64k with maxlevel == 16, but someone may
correct me on that)
-Andi
--
ak@linux.intel.com -- Speaking for myself only
next prev parent reply other threads:[~2011-09-24 1:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-23 23:45 BFS cpu scheduler and skip list implementation Con Kolivas
2011-09-24 1:21 ` Andi Kleen [this message]
2011-09-24 2:14 ` Con Kolivas
2011-09-24 7:35 ` Andi Kleen
2011-09-24 8:38 ` Con Kolivas
2011-09-29 20:45 ` Willy Tarreau
2011-09-29 22:58 ` Con Kolivas
2011-09-30 4:58 ` Willy Tarreau
2011-09-25 9:04 ` Heinz Diehl
2011-09-25 9:13 ` Con Kolivas
2011-09-25 11:16 ` Heinz Diehl
2011-09-25 11:19 ` Con Kolivas
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=m28vpeka65.fsf@firstfloor.org \
--to=andi@firstfloor.org \
--cc=kernel@kolivas.org \
--cc=linux-kernel@vger.kernel.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