linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: charlie.baylis@fish.zetnet.co.uk
To: Timothy Miller <miller@techsource.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] O12.2int for interactivity
Date: Wed, 6 Aug 2003 01:12:08 +0100	[thread overview]
Message-ID: <20030806001208.GA16287@fish.zetnet.co.uk> (raw)
In-Reply-To: <3F303494.3030406@techsource.com>

On Tue, Aug 05, 2003 at 06:49:56PM -0400, Timothy Miller wrote:
> The interactivity detection algorithm will always be inherently 
> imperfect.  Given that it is not psychic, it cannot tell in advance 
> whether or not a given process is supposed to be interactive, so it must 
> GUESS based on its behavior.
> 
> Furthermore, for any given scheduler algorithm, it is ALWAYS possible to 
> write a program which causes it to misbehave.
>
> This "thud" program is Goedel's theorem for the interactivity scheduler 
> (well, that's not exactly right, but you get the idea).  It breaks the 
> system.  If you redesign the scheduler to make "thud" work, then someone 
> will write "thud2" (which is what you have just done!) which breaks the 
> scheduler.  Ad infinitum.  It will never end.  And in this case, 
> optimizing for "thud" is likely also to make some other much more common 
> situations WORSE.

No, you've got this backwards. The thud program is a short piece of code
written to allow other kernel developers to reliably reproduce a specific
problem with the scheduler - that is, when only a small number of maximally
interactive tasks suddenly become CPU hogs they were able to starve most other
processes for several seconds.  This is an entirely real world case (see my
original posting to explain this), and it causes problems because, as you say,
the scheduler is not psychic.

I say you've got it backwards because thud is a much simpler piece of code than
Konqueror + XFree86, and it is simpler because uses 'reverse-engineered'
knowledge about the scheduler to manipulate it's dynamic priority to the point
where the scheduler problems I reported could be reproduced. As Con's changes
have broken these assumptions, thud needs updating so that it can continue to
behave equivalently on the newer schedulers. (The changes I gave will have no
effect on the old versions of the scheduler)

> So, while it MAY be of value to write a few "thud" programs, don't let 
> it go too far.  The scheduler should optimize for REAL loads -- things 
> that people actually DO.  You will always be able to break it by 
> reverse-engineering it and writing a program which violates its 
> expectations.  

I think you're confused between the thud test and the thud implementation.  The
thud implementation is a hacked up bit of C. The thud test is seeing a
maximally interactive task suddenly become a CPU hog. Once the implementation
no longer performs the test it ceases to be interesting[1], and it must be
updated, otherwise you aren't getting the test coverage you think you are
getting. 

Certainly, thud isn't the only program by which a scheduler should be measured.
If you have a better, more realistic and reproducible test case, or even just a
different one, which can help evaluate the performance of the interactivity
estimator then I'd love to see it :) (Actually, if you/someone can write a
simple program which can replace xmms skips as the standard "scheduler is
good/bad" benchmark that would be great. It wants to do n milliseconds of work
every m milliseconds and report the minimum/maximum/average time it took to do
the sleep and the work. Or something like that)

> Don't worry about it.  You will always be able to break it if you try hard
> enough.

The scheduler DOES have to cope with tasks which behave oddly, because it can
make bad decisions, and it has to be able to recover quickly or these corner
cases may be used to form a denial of service attack.

> As Linus says, "Perfect" is the enemy of "Good".

That doesn't preclude making things better. Otherwise, why ditch the "good" 2.4
scheduler :) 

Charlie

[1] unless the new test it performs is interesting for some other reason.

  reply	other threads:[~2003-08-06  0:10 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-04 19:50 [PATCH] O12.2int for interactivity Charlie Baylis
2003-08-05  2:10 ` Con Kolivas
2003-08-05 22:49 ` Timothy Miller
2003-08-06  0:12   ` charlie.baylis [this message]
2003-08-06  1:23   ` Con Kolivas
2003-08-06 22:24     ` Timothy Miller
2003-08-11  8:14   ` Rob Landley
2003-08-11 23:49     ` Timothy Miller
2003-08-12  0:17       ` William Lee Irwin III
2003-08-12 15:04         ` Timothy Miller
2003-08-12 23:32           ` William Lee Irwin III
2003-08-13 15:46             ` Timothy Miller
2003-08-14  6:09               ` William Lee Irwin III
2003-08-14  6:59                 ` Con Kolivas
2003-08-14  7:01                   ` William Lee Irwin III
2003-08-14  7:46                     ` Con Kolivas
2003-08-14 20:03                       ` Timothy Miller
2003-08-15 16:40                         ` Con Kolivas
2003-08-14 20:00                     ` Timothy Miller
2003-08-15 16:38                       ` Con Kolivas
2003-08-15 18:12                         ` Timothy Miller
2003-08-17  2:19                           ` William Lee Irwin III
2003-08-17 18:00                           ` Mike Fedyk
2003-08-14 19:57                   ` Timothy Miller
2003-08-15 16:35                     ` Con Kolivas
2003-08-15 18:17                       ` Timothy Miller
2003-08-16  2:29                         ` Con Kolivas
2003-08-14 19:54                 ` Timothy Miller
  -- strict thread matches above, loose matches on Subject: below --
2003-08-03 21:19 Voluspa
2003-08-04  2:34 ` Con Kolivas
2003-08-03 10:14 Con Kolivas
2003-08-03 11:25 ` Ingo Molnar
2003-08-03 11:36   ` Con Kolivas
2003-08-04  3:06   ` Con Kolivas
2003-08-03 11:37 ` Felipe Alfaro Solana

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=20030806001208.GA16287@fish.zetnet.co.uk \
    --to=charlie.baylis@fish.zetnet.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miller@techsource.com \
    /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;
as well as URLs for NNTP newsgroup(s).