public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: Willy Tarreau <w@1wt.eu>
Cc: Ingo Molnar <mingo@elte.hu>, Kasper Sandberg <lkml@metanurb.dk>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Gene Heskett <gene.heskett@gmail.com>,
	linux-kernel@vger.kernel.org, Con Kolivas <kernel@kolivas.org>,
	Nick Piggin <npiggin@suse.de>, Mike Galbraith <efault@gmx.de>,
	Arjan van de Ven <arjan@infradead.org>,
	Peter Williams <pwil3058@bigpond.net.au>,
	Thomas Gleixner <tglx@linutronix.de>,
	caglar@pardus.org.tr, Mark Lord <lkml@rtr.ca>,
	Zach Carter <linux@zachcarter.com>,
	buddabrod <buddabrod@gmail.com>
Subject: Re: [patch] CFS scheduler, -v6
Date: Sun, 29 Apr 2007 01:58:58 -0700	[thread overview]
Message-ID: <20070429085858.GA31925@holomorphy.com> (raw)
In-Reply-To: <20070429081317.GG23638@1wt.eu>

On Sun, Apr 29, 2007 at 12:54:36AM -0700, William Lee Irwin III wrote:
>> Common code for rbtree-based priority queues can be factored out of
>> cfq, cfs, and hrtimers.

On Sun, Apr 29, 2007 at 10:13:17AM +0200, Willy Tarreau wrote:
> In my experience, rbtrees are painfully slow. Yesterday, I spent the
> day replacing them in haproxy with other trees I developped a few
> years ago, which look like radix trees. They are about 2-3 times as
> fast to insert 64-bit data, and you walk through them in O(1). I have
> many changes to apply to them before they could be used in kernel, but
> at least I think we already have code available for other types of trees.

Dynamic allocation of auxiliary indexing structures is problematic for
the scheduler, which significantly constrains the algorithms one may
use for this purpose.

rbtrees are not my favorite either. Faster alternatives to rbtrees
exist even among binary trees; for instance, it's not so difficult to
implement a heap-ordered tree maintaining the red-black invariant with
looser constraints on the tree structure and hence less rebalancing.
One could always try implementing a van Emde Boas queue, if he felt
particularly brave.

Some explanation of the structure may be found at:
http://courses.csail.mit.edu/6.897/spring03/scribe_notes/L1/lecture1.pdf

According to that, y-trees use less space, and exponential trees are
asymptotically faster with a worst-case asymptotic running time of

	O(min(lg(lg(u))*lg(lg(n))/lg(lg(lg(u))), sqrt(lg(n)/lg(lg(n)))))

for all operations, so van Emde Boas is not the ultimate algorithm by
any means at O(lg(lg(u))); in these estimates, u is the size of the
"universe," or otherwise the range of the key data type. Not to say
that any of those are appropriate for the kernel; it's rather likely
we'll have to settle for something less interesting, if we bother
ditching rbtrees at all, on account of the constraints of the kernel
environment.

I'll see what I can do about a userspace test harness for priority
queues more comprehensive than smart-queue.c. I have in mind the
ability to replay traces obtained from queues in the kernel and loading
priority queue implementations via dlopen()/dlsym() et al. valgrind can
do most of the dirty work. Otherwise running a trace for some period of
time and emitting the number of operations it got through should serve
as a benchmark. With that in hand, people can grind out priority queue
implementations and see how they compare on real operation sequences
logged from live kernels.


-- wli

  reply	other threads:[~2007-04-29  8:59 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-25 21:47 [patch] CFS scheduler, -v6 Ingo Molnar
2007-04-26  2:14 ` Gene Heskett
2007-04-26  3:29 ` Nick Piggin
2007-04-26  3:49   ` Andrew Morton
2007-04-26  4:16   ` William Lee Irwin III
2007-04-26  8:27   ` Ingo Molnar
2007-04-26  9:18 ` Ingo Molnar
2007-04-26 14:06 ` Redeeman
2007-04-26 14:41   ` Gene Heskett
2007-04-26 20:09     ` Kasper Sandberg
2007-04-26 21:21       ` Gene Heskett
2007-04-27  4:02       ` Mike Galbraith
2007-04-27  6:01         ` Mike Galbraith
2007-04-27 11:53       ` Ingo Molnar
2007-04-27 11:55         ` Ingo Molnar
2007-04-27 13:39           ` Thomas Gleixner
2007-04-27 13:41             ` Ingo Molnar
2007-04-27 13:44             ` Thomas Gleixner
2007-04-28 15:35           ` Kasper Sandberg
2007-04-28 20:45             ` Lee Revell
2007-04-29  1:18             ` Kasper Sandberg
2007-04-29  5:30               ` Willy Tarreau
2007-04-29  6:45                 ` Mike Galbraith
2007-04-29  6:59                 ` Ingo Molnar
2007-04-29  7:16                   ` Willy Tarreau
2007-04-29  7:30                     ` Ingo Molnar
2007-04-29  7:38                       ` Willy Tarreau
2007-04-29  8:00                         ` Ingo Molnar
2007-04-29  8:02                           ` Willy Tarreau
2007-04-29  9:52                           ` Con Kolivas
2007-04-29 10:19                             ` Mike Galbraith
2007-04-29  7:54                     ` William Lee Irwin III
2007-04-29  8:03                       ` Ingo Molnar
2007-04-29  8:16                         ` William Lee Irwin III
2007-04-29  8:13                       ` Willy Tarreau
2007-04-29  8:58                         ` William Lee Irwin III [this message]
2007-04-29  8:11                     ` Mike Galbraith
2007-04-29 10:30                     ` Thomas Gleixner
2007-04-29 10:33                       ` William Lee Irwin III
2007-04-29 10:48                       ` Kasper Sandberg
2007-04-29 11:25                         ` Thomas Gleixner
2007-04-29 10:53                       ` Con Kolivas
2007-04-29 11:11                         ` Bill Huey
2007-04-29 11:50                         ` Thomas Gleixner
2007-04-29 11:11                       ` Willy Tarreau
2007-04-29 11:46                         ` Con Kolivas
2007-04-29 12:09                           ` Paolo Ciarrocchi
2007-04-29 15:39                             ` Gene Heskett
2007-04-29 11:59                         ` Thomas Gleixner
2007-04-29 12:25                           ` Willy Tarreau
2007-04-29 12:00                         ` Kasper Sandberg
2007-04-29 12:13                           ` Thomas Gleixner
2007-04-29 12:21                             ` Kasper Sandberg
2007-04-29 12:55                             ` William Lee Irwin III
2007-04-29 13:37                               ` Thomas Gleixner
2007-05-01  7:55                                 ` Nick Piggin
2007-05-01 13:00                                   ` William Lee Irwin III
2007-04-29 20:30                         ` Mark Lord
2007-04-29 15:28                     ` Gene Heskett
2007-04-29  7:59                   ` Kasper Sandberg
2007-04-29  8:05                     ` Ingo Molnar
2007-04-29 15:42                     ` Ray Lee
2007-04-29 17:09                       ` Kasper Sandberg
2007-04-29  6:47               ` Ingo Molnar
     [not found]               ` <20070429170908.GA31417@elte.hu>
     [not found]                 ` <20070429173902.GA4349@elte.hu>
2007-04-30 17:45                   ` 3d smoothness (was: Re: [patch] CFS scheduler, -v6) Kasper Sandberg
2007-04-30 20:17                     ` Ingo Molnar
2007-04-30 20:44                       ` Kasper Sandberg
2007-04-27 12:52         ` [patch] CFS scheduler, -v6 William Lee Irwin III
2007-04-27 13:02         ` Ingo Molnar
2007-04-27 21:16           ` Lee Revell
2007-04-26 22:48     ` Con Kolivas
2007-04-27  0:39       ` Gene Heskett
2007-04-27  0:57         ` Con Kolivas
2007-04-27  1:03           ` Gene Heskett
2007-04-27 20:54           ` Bill Davidsen
2007-04-26 16:05   ` Mike Galbraith
2007-04-26 19:27 ` Thomas Gleixner
2007-04-26 19:35   ` Ingo Molnar
2007-04-26 19:42     ` Thomas Gleixner
2007-04-26 20:11       ` Ingo Molnar
2007-04-27 13:19 ` Mark Lord
2007-04-27 13:22   ` Mark Lord
2007-04-27 13:45     ` Ingo Molnar
2007-04-28 12:45 ` Srivatsa Vaddagiri
2007-04-28 13:53   ` Ingo Molnar
2007-04-28 15:23     ` Srivatsa Vaddagiri
2007-04-28 15:22       ` Ingo Molnar
2007-04-28 15:28       ` Srivatsa Vaddagiri
  -- strict thread matches above, loose matches on Subject: below --
2007-04-27 21:59 Art Haas

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=20070429085858.GA31925@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=buddabrod@gmail.com \
    --cc=caglar@pardus.org.tr \
    --cc=efault@gmx.de \
    --cc=gene.heskett@gmail.com \
    --cc=kernel@kolivas.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@zachcarter.com \
    --cc=lkml@metanurb.dk \
    --cc=lkml@rtr.ca \
    --cc=mingo@elte.hu \
    --cc=npiggin@suse.de \
    --cc=pwil3058@bigpond.net.au \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=w@1wt.eu \
    /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