linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@transmeta.com>
To: Andrew Morton <akpm@digeo.com>
Cc: rml@tech9.net, <mingo@elte.hu>, <linux-kernel@vger.kernel.org>
Subject: Re: [patch] "HT scheduler", sched-2.5.63-B3
Date: Thu, 6 Mar 2003 07:37:31 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.44.0303060710350.7206-100000@home.transmeta.com> (raw)
In-Reply-To: <20030305234553.715f975e.akpm@digeo.com>


On Wed, 5 Mar 2003, Andrew Morton wrote:
> 
> But it is a heuristic, and it will inevitably make mistakes.  The problem
> which I am observing is that the cost of those mistakes is very high.

The problem I used to see quite clearly is that X gets turned into a
non-interactive task, because with a complex X desktop X can easily use
5-15% of CPU even when everything is perfectly normal. That's simply
because it ends up having to _do_ a lot: anti-aliased text, shifting
logos, xdaliclock in the corner, blinking cursors, annoying moving
advertising on web-sites, small animations in the task-bar etc.

And the current heuristic SUCKS for this. And it's quite fundamental: the
heuristic is _wrong_. The heuristic breaks down _completely_ when there
are ten CPU hogs that peg the CPU, and now the one process that wants 10% 
of the CPU suddenly doesn't sleep any more, since it ends up needing all 
the timeslices it could get.

At this point the current heurstic totally breaks down, and doesn't have 
any way out. The _only_ part of Ingo's patch that may help is the fact 
that he made the maximum timeslice be smaller, but realize that since X 
is now considered to be a background task, that doesn't help very much 
_either_, since it's going to be scheduled round-robin with those other 
ten background tasks, and changing the max timeslice from 300 to 200ms 
only means that the pauses will be "only" two seconds instead of being 
three seconds.

See? 

I told Ingo about it half a year ago, and he ignored it then, saying it 
can't be solved. Re-nicing X doesn't really help: it only hides the 
problem because it means that X won't be scheduled round-robin with the 
background load any more, but because it makes X more important than user 
processes it then has other fundamental flaws.

So with "nice -10", when X gets busy, it gets _too_ busy and locks out
other processes - it fixes the interactivity, but it causes latency
problems because X is still considered a _background_ job, so it gets a 
200ms timeslice at high priority and guess what? That kind of sucks for 
regular programs that want low latency.

> Let me redescribe the problem:
> 
> - Dual 850MHz PIII, 900M of RAM.
> - Start a `make -j3 vmlinux', everything in pagecache
> - Start using X applications.  Moving a window about is the usual trigger.

Yeah. Guess what? Moving a window makes X suddenly use a lot more CPU (try 
turning off acceleration if you _really_ want to see it), so you see the 
fundamental problem with less load. Add some load (and some X eye-candy) 
and you will see it much easier. 

And read the above description of what happens, and realize that it is 
_fundamental_.

And guess what my 5-liner patch tries to address? The one that you didn't
bother testing.. The one that actually tries to tackle the problem head-on 
instead of hiding it. 

> Interestingly, this does not happen if the background load is a bunch of
> busywaits.  It seems to need the fork&exit load of a compilation to trigger.

It happened with busy-waits too last time I checked (which is about halfa
year ago), it's just that a normal busy-wait tends to _do_ a lot less than
doign a fork()/wait()/busy-child. When the load on the CPU becomes
"constrained" (ie when the CPU idle time goes down to zero) of a
fork/wait/busy-child, suddenly that isn't a load unit of "1" any more, 
since the fork/wait/exit actually takes time.

Which means that you may need 6 busy-wait tasks to get the same kind of 
real load that you get with just 3 fork/wait/exit things.

> Robert was able to reproduce this, and noticed that the scheduler had niced
> the X server down as far as it would go.

Right. It's totally starved for CPU, so it never sleeps, so it gets turned 
into non-interactive, so it gets round-robined-with-the-background-tasks.

> I'm a pretty pathological case, because I was driving two 1600x1200x24
> displays with a crufty old AGP voodoo3 and a $2 PCI nvidia.  Am now using a
> presumably less crufty radeon and the problem persists.

I saw the problem on this 4-CPU machine with my old graphics card, which 
was something perfectly moderns (ATI Radeon 7000). I can still trigger it 
even with my current Radeon 8500, but I need to basically make the build 
be "make -j15" ot something like that to trigger it, at which point I'm 
not sure it's relevant any more..

And yes, I think my five-liner makes a difference to me, but since I need
to push the machine so far "off" a reasonable load to trigger it, I don't
think my machine is a good test.

A good test is a fairly slow graphics card, with some stuff happening all 
the time on the screen (ie xdaliclock or a noisy web-site). And then 
seeing what moving a window does when doing a compile.

The window moving itself is not helped by my patch, but my patch _should_
mean that the _users_ of X (which are less starved for CPU than X is,
since they don't actually have to do the heavy lifting) will be giving X
"life points" as X wakes them up.

And that's the whole point of the patch. Any synchronous wake-up that 
wakes up an interactive task is a _good_ thing. Not just for the 
interactive task itself, but also for the thing that causes it to wake up. 
It makes X itself more interactive - it still goes into "background mode" 
for short stretches, but it seems to need more pushing, and it seems 
to come out of its funk faster.

Note the "seems". This is why I'd like others to test it - since it's very 
much a perception issue.

		Linus


  parent reply	other threads:[~2003-03-06 15:29 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-28  9:50 [patch] "HT scheduler", sched-2.5.63-B3 Ingo Molnar
2003-02-28 21:12 ` Andrew Morton
2003-02-28 21:23   ` Robert Love
2003-03-01  4:25     ` Andrew Morton
2003-03-06  3:20       ` Linus Torvalds
2003-03-06  7:45         ` Andrew Morton
2003-03-06  7:47           ` Ingo Molnar
2003-03-06 15:07             ` Linus Torvalds
2003-03-06 16:54               ` Ingo Molnar
2003-03-06 17:03                 ` Linus Torvalds
2003-03-06 17:24                   ` Ingo Molnar
2003-03-06 17:42                     ` Linus Torvalds
2003-03-06 17:54                       ` Ingo Molnar
2003-03-06 18:02                         ` Linus Torvalds
2003-03-06 18:11                           ` Ingo Molnar
2003-03-06 17:55                       ` John Levon
2003-03-06 18:07                         ` Linus Torvalds
2003-03-06 18:11                           ` John Levon
2003-03-06 18:16                             ` Linus Torvalds
2003-03-06 18:15                           ` Ingo Molnar
2003-03-06 18:20                             ` Linus Torvalds
2003-03-06 18:10                               ` David S. Miller
2003-03-06 18:18                           ` Ingo Molnar
2003-03-07  5:57                       ` Ingo Molnar
2003-03-07  5:54                         ` Shawn
2003-03-07  6:04                           ` Ingo Molnar
2003-03-07 14:28                         ` jlnance
2003-03-07  6:45                       ` Aaron Lehmann
2003-03-07  6:50                         ` Ingo Molnar
2003-03-07  7:00                           ` Aaron Lehmann
2003-03-07  7:36                             ` Ingo Molnar
2003-03-08 18:28                               ` Aaron Lehmann
2003-03-07  7:00                         ` Andrew Morton
2003-03-07  3:19                   ` Horst von Brand
2003-03-06 15:37           ` Linus Torvalds [this message]
2003-03-06 16:01             ` Jeff Garzik
2003-03-06 16:51               ` Linus Torvalds
2003-03-06 17:11                 ` Ingo Molnar
2003-03-06 17:52                   ` jvlists
2003-03-06 18:27                     ` Ingo Molnar
2003-03-07  8:15                       ` Xavier Bestel
2003-03-06 23:18                     ` Robert Love
2003-03-06 18:49                   ` Alan Cox
2003-03-06 17:55                     ` Linus Torvalds
2003-03-06 18:04                       ` Ingo Molnar
2003-03-06 18:13                         ` Martin J. Bligh
2003-03-06 18:26                           ` Linus Torvalds
2003-03-08  0:05                       ` Daniel Phillips
2003-03-06 17:58                     ` Ingo Molnar
2003-03-06 17:17               ` Ingo Molnar
2003-03-06 18:06                 ` Dimitrie O. Paun
2003-03-06 22:14                   ` Martin J. Bligh
2003-03-06 22:31                     ` Dimitrie O. Paun
2003-03-06 23:05                       ` Robert Love
2003-03-06 23:33                         ` Martin J. Bligh
2003-03-06 18:25               ` Alan Cox
2003-03-06 17:35                 ` Linus Torvalds
2003-03-06 22:30                   ` Eric Northup
2003-03-06 23:40                     ` Martin J. Bligh
2003-03-07  0:02                       ` Linus Torvalds
2003-03-07  0:09                         ` Dimitrie O. Paun
2003-03-06 22:00               ` Bill Davidsen
2003-03-06 17:13         ` Ingo Molnar
2003-03-06 17:30           ` Linus Torvalds
2003-03-06 17:33             ` Ingo Molnar
2003-03-06 17:50             ` Ingo Molnar
2003-03-06 18:00               ` Linus Torvalds
2003-03-06 20:42         ` Andrew Morton
2003-03-06 22:18           ` Robert Love
2003-03-07  5:52           ` Ingo Molnar
2003-03-07  5:51             ` Shawn
2003-03-07  6:01               ` Ingo Molnar
2003-03-07  6:07               ` Andrew Morton
2003-03-07  6:15           ` Ingo Molnar
2003-03-07 10:19             ` Helge Hafting
2003-03-07 11:06               ` Ingo Molnar
2003-03-07  7:45           ` Mike Galbraith
2003-03-07  7:45             ` Ingo Molnar
     [not found]             ` <Pine.LNX.4.44.0303070842420.4572-100000@localhost.localdom ain>
2003-03-07  8:09               ` Mike Galbraith
2003-03-07  8:10                 ` Andrew Morton
2003-03-07  8:26                   ` Mike Galbraith
2003-03-07  8:15                 ` Ingo Molnar
     [not found]                 ` <Pine.LNX.4.44.0303070913370.5173-100000@localhost.localdom ain>
2003-03-07  8:34                   ` Mike Galbraith
2003-03-07  8:31                     ` Ingo Molnar
2003-03-06 22:03         ` Martin Waitz
2003-03-06 22:07           ` Robert Love
2003-03-06 22:35             ` Martin Waitz
2003-03-06 22:56               ` Robert Love
2003-03-06 23:27                 ` Martin Waitz
2003-03-06 23:36                   ` Robert Love
2003-03-07 10:39                     ` Ingo Molnar
2003-03-07 10:27             ` Ingo Molnar
2003-03-06  6:58       ` [patch] "interactivity changes", sched-2.5.64-A4 Ingo Molnar
2003-03-06 10:00         ` Andrew Morton
2003-03-06 10:07           ` [patch] "interactivity changes", sched-2.5.64-A5 Ingo Molnar
2003-03-06 10:16 ` [patch] "HT scheduler", sched-2.5.63-B3 Chris Wedgwood
2003-03-06 10:18   ` Ingo Molnar
     [not found] <5.2.0.9.2.20030307093435.01a8fe88@pop.gmx.net>
2003-03-07  9:30 ` Ingo Molnar
     [not found] ` <Pine.LNX.4.44.0303071003060.6318-100000@localhost.localdom ain>
2003-03-07  9:38   ` Mike Galbraith
2003-03-10 19:53 Perez-Gonzalez, Inaky

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=Pine.LNX.4.44.0303060710350.7206-100000@home.transmeta.com \
    --to=torvalds@transmeta.com \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rml@tech9.net \
    /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).