* Re: [report] renicing X, cfs-v5 vs sd-0.46
[not found] ` <8dawR-4zw-21@gated-at.bofh.it>
@ 2007-04-23 18:52 ` Niel Lambrechts
2007-04-24 1:51 ` Gene Heskett
0 siblings, 1 reply; 8+ messages in thread
From: Niel Lambrechts @ 2007-04-23 18:52 UTC (permalink / raw)
To: Gene Heskett, linux-kernel
Gene Heskett wrote:
> This message prompted me to do some checking in re context switches myself,
> and I've come to the conclusion that there could be a bug in vmstat itself.
Perhaps. perhaps not. :)
> Run singly the context switching is reasonable even for a -19 niceness of x,
> its only showing about 200 or so on the first loop of vmstat. But throw in
> the -n 1 arguments and it goes crazy on the second and subsequent loops.
man vmstat:
"The first report produced gives averages since the last reboot.
Additional reports give information on a sampling period of length delay."
Regards,
Niel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [report] renicing X, cfs-v5 vs sd-0.46
2007-04-23 18:52 ` [report] renicing X, cfs-v5 vs sd-0.46 Niel Lambrechts
@ 2007-04-24 1:51 ` Gene Heskett
0 siblings, 0 replies; 8+ messages in thread
From: Gene Heskett @ 2007-04-24 1:51 UTC (permalink / raw)
To: Niel Lambrechts; +Cc: linux-kernel
On Monday 23 April 2007, Niel Lambrechts wrote:
>Gene Heskett wrote:
>> This message prompted me to do some checking in re context switches
>> myself, and I've come to the conclusion that there could be a bug in
>> vmstat itself.
>
>Perhaps. perhaps not. :)
>
>> Run singly the context switching is reasonable even for a -19 niceness of
>> x, its only showing about 200 or so on the first loop of vmstat. But
>> throw in the -n 1 arguments and it goes crazy on the second and subsequent
>> loops.
>
>man vmstat:
>"The first report produced gives averages since the last reboot.
>Additional reports give information on a sampling period of length delay."
I missed that, concentrating on finding the method of telling it the delay I
guess.
So then the next question is, over what period is that obviously lower figure
being averaged over? Certainly not over a 1 second period else it would then
be much higher, as seen by the figures after the initial delay. The time
slice spec'd in /proc/sys/kernel/sched_granularity_ns, which here is
currently 5000000 or 5 milliseconds? If that was the case, the first answer
would be in the area of 15, not 200.
So educate me, off list if you would like and have the time.
Thanks Niel.
--
Cheers, Gene
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Sweet sixteen is beautiful Bess,
And her voice is changing -- from "No" to "Yes".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [report] renicing X, cfs-v5 vs sd-0.46
2007-04-23 19:48 ` Ingo Molnar
@ 2007-04-23 20:56 ` Michael K. Edwards
0 siblings, 0 replies; 8+ messages in thread
From: Michael K. Edwards @ 2007-04-23 20:56 UTC (permalink / raw)
To: Ingo Molnar
Cc: Linus Torvalds, Juliusz Chroboczek, Con Kolivas, ck list,
Bill Davidsen, Willy Tarreau, William Lee Irwin III,
linux-kernel, Andrew Morton, Nick Piggin, Mike Galbraith,
Arjan van de Ven, Peter Williams, Thomas Gleixner, caglar,
Gene Heskett
On 4/23/07, Ingo Molnar <mingo@elte.hu> wrote:
> Basically this hack is bad on policy grounds because it is giving X an
> "legislated, unfair monopoly" on the system. It's the equivalent of a
> state-guaranteed monopoly in certain 'strategic industries'. It has some
> advantages but it is very much net harmful. Most of the time the
> "strategic importance" of any industry can be cleanly driven by the
> normal mechanics of supply and demand: anything important is recognized
> by 'people' as important via actual actions of giving it 'money'. (This
> approach also gives formerly-strategic industries the boot quickly, were
> they to become less strategic to people as things evolve.)
If you're going to drag free-market economics into it, why not
actually use the techniques of free-market economics? Design a
bidding system in which agents (tasks) earn "money" by getting things
done, and can use that "money" to bid on "resources". You will of
course need accurate cost accounting in order to decide which bids are
most "profitable" for the scheduler to accept, and accurate transfer
accounting to design price structures for contracts between agents in
which one agrees to accomplish work on behalf on another. Actual
revenues come from doing the work that the consumer wants done and is
willing to pay for. Etc., etc. Has your horsepucky filter kicked in
yet?
If your system doesn't work this way -- perhaps because you think as I
do that scheduler design is principally an engineering problem, not an
economics problem -- then analogies from economics are probably worth
zip. Yes, I wrote earlier about "economic dispatch" -- that's an
operations problem, a control theory problem, an _engineering_
problem, that happens to have a set of engineering goals and
constraints that take profitability into account. I think you might
be able to design a better Linux scheduler anchored in the techniques
and literature of control theory, perhaps specifically with reference
to electric-utility economic dispatch, because the systems under
control and the goals of control are similar.
But there's a good reason not to treat X as special. Namely, that it
_isn't_. It may be the only program on many people's Linux desktops
with an opaque control structure -- a separate class of interactive
activities hidden inside an oversubscribed push-model pipeline stage
-- but it's hardly the only program designed this way. Treat the X
server as a easily instrumented exemplar of a event-loop-centric
design whose thread structure doesn't distinguish between fast-twitch
and best-effort activity patterns. I wrote earlier about what one
might do about this (attach urgency to to the work in the queue
instead of the worker being asked to do it).
Cheers,
- Michael
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [report] renicing X, cfs-v5 vs sd-0.46
2007-04-23 15:09 ` Linus Torvalds
2007-04-23 17:19 ` Gene Heskett
2007-04-23 17:19 ` Gene Heskett
@ 2007-04-23 19:48 ` Ingo Molnar
2007-04-23 20:56 ` Michael K. Edwards
2 siblings, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2007-04-23 19:48 UTC (permalink / raw)
To: Linus Torvalds
Cc: Juliusz Chroboczek, Con Kolivas, ck list, Bill Davidsen,
Willy Tarreau, William Lee Irwin III, linux-kernel,
Andrew Morton, Nick Piggin, Mike Galbraith, Arjan van de Ven,
Peter Williams, Thomas Gleixner, caglar, Gene Heskett
* Linus Torvalds <torvalds@linux-foundation.org> wrote:
> > 4 0 0 475752 13492 176320 0 0 0 0 107 1477 85 15 0 0 0
> > 4 0 0 475752 13492 176320 0 0 0 0 122 1498 84 16 0 0 0
>
> Did you even *look* at your own numbers? Maybe you looked at
> "interrpts". The context switch numbers go from 170 per second, to
> 1500 per second!
i think i managed to look at the correct column :) 1500 per second is
the absolute ceiling under CFS.
but, even though this utterly ugly hack of renicing (Arjan immediately
slapped me for it when i mentioned it to him and he correctly predicted
that lkml would go amok on anything like this) undeniably behaves better
under CFS and gives a _visually better_ desktop at a 1500 context
switches per second, i share your unease about it on architectural and
policy grounds. Doing this hack upstream could easily hinder the
efficient creation of a healthy economy for "scheduler money", by
forcibly hacking X out of the picture - while X could be such a nice
(and important) prototype for a cool and useful new scheduling
infrastructure.
Basically this hack is bad on policy grounds because it is giving X an
"legislated, unfair monopoly" on the system. It's the equivalent of a
state-guaranteed monopoly in certain 'strategic industries'. It has some
advantages but it is very much net harmful. Most of the time the
"strategic importance" of any industry can be cleanly driven by the
normal mechanics of supply and demand: anything important is recognized
by 'people' as important via actual actions of giving it 'money'. (This
approach also gives formerly-strategic industries the boot quickly, were
they to become less strategic to people as things evolve.)
still, recognizing all the very real advantages of a cleaner approach,
my primary present goal with CFS is to reach "maximum interactivity"
here and today on a maximimally broad set of workloads, whatever it
takes, and then to look back and figure out cleaner ways while still
carefully keeping that maximum interactivity propertly of CFS.
For this particular auto-renicing hack here are the observed objective
advantages to the user:
1) while it's still an ugly hack, the increased context-switching rate
(surprisingly to me!) still has actual, objective, undeniable
positive effects even in this totally X-centric worst-case messaging
scenario i tried to trigger:
- visibly better eye-pleasing X behavior under the same
"performance of scrolling"
- no hung mouse pointer. Ever. I'd not go as far as Windows to
put the mouse refresh code into the kernel, but now having
experienced under CFS the 'mouse never hangs under any load'
phenomenon for a longer time, i have to admit i got addicted
to it. It give instant emotionally positive feedback about
"yes, your system is still fine, just overworked a bit", and
it also gives a "you caused something to happen on this box,
cool boy!" reassurance to the impatient human who is waiting
on it - be it that such a minimal thing as a moving mouse
pointer.
There's a new argument as well, not amongst the issues i raised
before: people are happily spending 40-50% of their CPU's
power on Beryl just to get a more ergonomic desktop via 3D effects,
so why not allow them to achieve another type of visual ergonomy by
allowing an increased, maximum-throttled X context-switch rate,
without any measurable drop in performance, to a tunable maximum?
I can see no easy way for X itself to control this context-switching
"refresh" rate in a sane way, as its workload is largely detached
from client workloads and there's no communication between clients.
2) it's the absolute worst maximum rate you'll ever see under CFS, and
i definitely concentrated on triggering the worst-case. On other
schedulers i easily got to 14K context-switches per second or worse,
depending on the X workload, which hurts performance and makes it
behave visually worse. On CFS the 1400 context-switches is the
_ceiling_, did not measurably hurt performance and it is tunable
ceiling.
3) this behavior was totally uncontrollable on other schedulers i tried
and indeed has hurt performance there. On CFS this is still totally
tunable and controllable on several levels.
i'm not saying that any of this reduces the ugliness of the hack, or
that any of this makes the strategic disadvantages of this hack
disappear, i simply tried to point out that despite the existing
conventional wisdom it's apparently much more useful in practice on CFS
than on other schedulers.
And if the "economy of scheduling" experiment fails in practice for some
presently unknown technological reason, we might as well have to go back
to ugly tricks like this one. With its 5 lines and limited scope i think
it still beats 500 lines of convoluted scheduling heuristics :-/ Right
now i'm very positive about the "economy of scheduling" angle, i think
we have a realistic chance to pull it off.
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [report] renicing X, cfs-v5 vs sd-0.46
2007-04-23 15:09 ` Linus Torvalds
2007-04-23 17:19 ` Gene Heskett
@ 2007-04-23 17:19 ` Gene Heskett
2007-04-23 19:48 ` Ingo Molnar
2 siblings, 0 replies; 8+ messages in thread
From: Gene Heskett @ 2007-04-23 17:19 UTC (permalink / raw)
To: Linus Torvalds
Cc: Ingo Molnar, Juliusz Chroboczek, Con Kolivas, ck list,
Bill Davidsen, Willy Tarreau, William Lee Irwin III,
linux-kernel, Andrew Morton, Nick Piggin, Mike Galbraith,
Arjan van de Ven, Peter Williams, Thomas Gleixner, caglar
On Monday 23 April 2007, Linus Torvalds wrote:
>On Mon, 23 Apr 2007, Ingo Molnar wrote:
>> You are completely right in the case of traditional schedulers.
>
>And apparently I'm completely right with CFS too.
>
>> Using CFS-v5, with Xorg at nice 0, the context-switch rate is low:
>>
>> procs -----------memory---------- ---swap-- -----io---- --system--
>> -----cpu------ r b swpd free buff cache si so bi bo in
>> cs us sy id wa st 2 0 0 472132 13712 178604 0 0 0 32
>> 113 170 83 17 0 0 0 2 0 0 472172 13712 178604 0 0 0
>> 0 112 184 85 15 0 0 0 2 0 0 472196 13712 178604 0 0
>> 0 0 108 162 83 17 0 0 0 1 0 0 472076 13712 178604 0
>> 0 0 0 115 189 86 14 0 0 0
>
>Around 170 context switches per second.
>
>> Renicing X to -10 increases context-switching, but not dramatically so,
>> because it is throttled by CFS:
>>
>> procs -----------memory---------- ---swap-- -----io---- --system--
>> -----cpu------ r b swpd free buff cache si so bi bo in
>> cs us sy id wa st 4 0 0 475752 13492 176320 0 0 0 64
>> 116 1498 85 15 0 0 0 4 0 0 475752 13492 176320 0 0 0
>> 0 107 1488 84 16 0 0 0 4 0 0 475752 13492 176320 0 0
>> 0 0 140 1514 86 14 0 0 0 4 0 0 475752 13492 176320 0
>> 0 0 0 107 1477 85 15 0 0 0 4 0 0 475752 13492 176320
>> 0 0 0 0 122 1498 84 16 0 0 0
>
>Did you even *look* at your own numbers? Maybe you looked at "interrpts".
>The context switch numbers go from 170 per second, to 1500 per second!
>
>If that's not "dramatically so", I don't know what is! Just how many
>orders of magnitude worse does it have to be, to be "dramatic"? Apparently
>one order of magnitude isn't "dramatic"?
>
>So you were wrong. The fact that it was still "usable" is a good
>indication, but how about just admitting that you were wrong, and that
>renicing X is the *WRONG*THING*TO*DO*.
>
>Just don't do it. It's wrong. It was wrong with the old schedulers, it's
>wrong with the new scheduler, it's just WRONG.
>
>It was a hack, and it's a failed hack. And the fact that you don't seem to
>realize that it's a failure, even when your OWN numbers clearly show that
>it's failed, is a bit scary.
>
> Linus
This message prompted me to do some checking in re context switches myself,
and I've come to the conclusion that there could be a bug in vmstat itself.
Run singly the context switching is reasonable even for a -19 niceness of x,
its only showing about 200 or so on the first loop of vmstat. But throw in
the -n 1 arguments and it goes crazy on the second and subsequent loops.
X nice=0
[root@coyote ~]# vmstat -n 1
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa
st
3 0 324 62836 37952 518080 0 0 786 446 474 201 10 4 82 4
0
0 0 324 62712 37952 518080 0 0 0 0 1309 2361 2 5 93 0
0
2 0 324 62712 37952 518080 0 0 0 0 1275 2203 2 4 94 0
0
0 0 324 62744 37952 518080 0 0 0 0 1305 2224 1 2 97 0
0
0 0 324 62744 37952 518080 0 0 0 0 1291 2232 0 1 99 0
0
X nice=-10
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa
st
3 0 324 62432 38052 518080 0 0 784 445 476 205 10 4 82 4
0
0 0 324 62432 38052 518080 0 0 0 0 1190 3223 1 1 98 0
0
2 0 324 62440 38052 518080 0 0 0 0 1209 3210 2 3 95 0
0
0 0 324 62316 38060 518080 0 0 0 232 1201 3355 3 4 92 1
0
2 0 324 62316 38060 518080 0 0 0 0 1207 2794 1 2 97 0
0
X nice=10
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa
st
4 0 324 62372 38184 518132 0 0 783 445 477 209 10 4 82 4
0
0 0 324 62372 38192 518132 0 0 0 272 1318 2262 0 3 97 0
0
0 0 324 62372 38192 518132 0 0 0 0 1293 2249 1 4 95 0
0
0 0 324 62248 38192 518132 0 0 0 0 1280 2443 4 2 94 0
0
0 0 324 62248 38192 518132 0 0 0 4 1294 2272 0 3 97 0
0
Now, I have NDI which set of figures is the true set, but please note that in
all 3 cases the reported values for cs didn't scale up and down all that much
if separated out into 1st pass, and subsequent passes.
And, even with X nice=10, the system is still fairly smooth and usable.
This is with 2.6.21-rc7-CFS-v5 I built late last evening. At Xnice=10 I just
played a game of patience to watch the card animations and they were
absolutely acceptably smooth. (and I won it in about 112 moves :)
>From this users viewpoint, it (cfs-v5) works, and works very well indeed, and
it deserves a place as one of 3 selectable options in mainline. The other 2
being the existing mainline way, & Con K's sd-0.45 or later. Both of these
seem to be very large enhancements to the user experience over current
mainline, which I'd discuss in terms borrowed from Joanne Dow. Comparatively
speaking, mainline has a very high vacuum.
--
Cheers, Gene
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Jayne: "Let's move this conversation in a not-Jayne's-fault direction."
--Episode #14, "Objects in Space"
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [report] renicing X, cfs-v5 vs sd-0.46
2007-04-23 15:09 ` Linus Torvalds
@ 2007-04-23 17:19 ` Gene Heskett
2007-04-23 17:19 ` Gene Heskett
2007-04-23 19:48 ` Ingo Molnar
2 siblings, 0 replies; 8+ messages in thread
From: Gene Heskett @ 2007-04-23 17:19 UTC (permalink / raw)
To: Linus Torvalds
Cc: Ingo Molnar, Juliusz Chroboczek, Con Kolivas, ck list,
Bill Davidsen, Willy Tarreau, William Lee Irwin III,
linux-kernel, Andrew Morton, Nick Piggin, Mike Galbraith,
Arjan van de Ven, Peter Williams, Thomas Gleixner, caglar
On Monday 23 April 2007, Linus Torvalds wrote:
>On Mon, 23 Apr 2007, Ingo Molnar wrote:
>> You are completely right in the case of traditional schedulers.
>
>And apparently I'm completely right with CFS too.
>
>> Using CFS-v5, with Xorg at nice 0, the context-switch rate is low:
>>
>> procs -----------memory---------- ---swap-- -----io---- --system--
>> -----cpu------ r b swpd free buff cache si so bi bo in
>> cs us sy id wa st 2 0 0 472132 13712 178604 0 0 0 32
>> 113 170 83 17 0 0 0 2 0 0 472172 13712 178604 0 0 0
>> 0 112 184 85 15 0 0 0 2 0 0 472196 13712 178604 0 0
>> 0 0 108 162 83 17 0 0 0 1 0 0 472076 13712 178604 0
>> 0 0 0 115 189 86 14 0 0 0
>
>Around 170 context switches per second.
>
>> Renicing X to -10 increases context-switching, but not dramatically so,
>> because it is throttled by CFS:
>>
>> procs -----------memory---------- ---swap-- -----io---- --system--
>> -----cpu------ r b swpd free buff cache si so bi bo in
>> cs us sy id wa st 4 0 0 475752 13492 176320 0 0 0 64
>> 116 1498 85 15 0 0 0 4 0 0 475752 13492 176320 0 0 0
>> 0 107 1488 84 16 0 0 0 4 0 0 475752 13492 176320 0 0
>> 0 0 140 1514 86 14 0 0 0 4 0 0 475752 13492 176320 0
>> 0 0 0 107 1477 85 15 0 0 0 4 0 0 475752 13492 176320
>> 0 0 0 0 122 1498 84 16 0 0 0
>
>Did you even *look* at your own numbers? Maybe you looked at "interrpts".
>The context switch numbers go from 170 per second, to 1500 per second!
>
>If that's not "dramatically so", I don't know what is! Just how many
>orders of magnitude worse does it have to be, to be "dramatic"? Apparently
>one order of magnitude isn't "dramatic"?
>
>So you were wrong. The fact that it was still "usable" is a good
>indication, but how about just admitting that you were wrong, and that
>renicing X is the *WRONG*THING*TO*DO*.
>
>Just don't do it. It's wrong. It was wrong with the old schedulers, it's
>wrong with the new scheduler, it's just WRONG.
>
>It was a hack, and it's a failed hack. And the fact that you don't seem to
>realize that it's a failure, even when your OWN numbers clearly show that
>it's failed, is a bit scary.
>
> Linus
This message prompted me to do some checking in re context switches myself,
and I've come to the conclusion that there could be a bug in vmstat itself.
Run singly the context switching is reasonable even for a -19 niceness of x,
its only showing about 200 or so on the first loop of vmstat. But throw in
the -n 1 arguments and it goes crazy on the second and subsequent loops.
X nice=0
[root@coyote ~]# vmstat -n 1
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa
st
3 0 324 62836 37952 518080 0 0 786 446 474 201 10 4 82 4
0
0 0 324 62712 37952 518080 0 0 0 0 1309 2361 2 5 93 0
0
2 0 324 62712 37952 518080 0 0 0 0 1275 2203 2 4 94 0
0
0 0 324 62744 37952 518080 0 0 0 0 1305 2224 1 2 97 0
0
0 0 324 62744 37952 518080 0 0 0 0 1291 2232 0 1 99 0
0
X nice=-10
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa
st
3 0 324 62432 38052 518080 0 0 784 445 476 205 10 4 82 4
0
0 0 324 62432 38052 518080 0 0 0 0 1190 3223 1 1 98 0
0
2 0 324 62440 38052 518080 0 0 0 0 1209 3210 2 3 95 0
0
0 0 324 62316 38060 518080 0 0 0 232 1201 3355 3 4 92 1
0
2 0 324 62316 38060 518080 0 0 0 0 1207 2794 1 2 97 0
0
X nice=10
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa
st
4 0 324 62372 38184 518132 0 0 783 445 477 209 10 4 82 4
0
0 0 324 62372 38192 518132 0 0 0 272 1318 2262 0 3 97 0
0
0 0 324 62372 38192 518132 0 0 0 0 1293 2249 1 4 95 0
0
0 0 324 62248 38192 518132 0 0 0 0 1280 2443 4 2 94 0
0
0 0 324 62248 38192 518132 0 0 0 4 1294 2272 0 3 97 0
0
Now, I have NDI which set of figures is the true set, but please note that in
all 3 cases the reported values for cs didn't scale up and down all that much
if separated out into 1st pass, and subsequent passes.
And, even with X nice=10, the system is still fairly smooth and usable.
This is with 2.6.21-rc7-CFS-v5 I built late last evening. At Xnice=10 I just
played a game of patience to watch the card animations and they were
absolutely acceptably smooth. (and I won it in about 112 moves :)
>From this users viewpoint, it (cfs-v5) works, and works very well indeed, and
it deserves a place as one of 3 selectable options in mainline. The other 2
being the existing mainline way, & Con K's sd-0.45 or later. Both of these
seem to be very large enhancements to the user experience over current
mainline, which I'd discuss in terms borrowed from Joanne Dow. Comparatively
speaking, mainline has a very high vacuum.
--
Cheers, Gene
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Jayne: "Let's move this conversation in a not-Jayne's-fault direction."
--Episode #14, "Objects in Space"
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [report] renicing X, cfs-v5 vs sd-0.46
2007-04-23 2:42 ` [report] renicing X, cfs-v5 vs sd-0.46 Ingo Molnar
@ 2007-04-23 15:09 ` Linus Torvalds
2007-04-23 17:19 ` Gene Heskett
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Linus Torvalds @ 2007-04-23 15:09 UTC (permalink / raw)
To: Ingo Molnar
Cc: Juliusz Chroboczek, Con Kolivas, ck list, Bill Davidsen,
Willy Tarreau, William Lee Irwin III, linux-kernel,
Andrew Morton, Nick Piggin, Mike Galbraith, Arjan van de Ven,
Peter Williams, Thomas Gleixner, caglar, Gene Heskett
On Mon, 23 Apr 2007, Ingo Molnar wrote:
>
> You are completely right in the case of traditional schedulers.
And apparently I'm completely right with CFS too.
> Using CFS-v5, with Xorg at nice 0, the context-switch rate is low:
>
> procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
> r b swpd free buff cache si so bi bo in cs us sy id wa st
> 2 0 0 472132 13712 178604 0 0 0 32 113 170 83 17 0 0 0
> 2 0 0 472172 13712 178604 0 0 0 0 112 184 85 15 0 0 0
> 2 0 0 472196 13712 178604 0 0 0 0 108 162 83 17 0 0 0
> 1 0 0 472076 13712 178604 0 0 0 0 115 189 86 14 0 0 0
Around 170 context switches per second.
> Renicing X to -10 increases context-switching, but not dramatically so,
> because it is throttled by CFS:
>
> procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
> r b swpd free buff cache si so bi bo in cs us sy id wa st
> 4 0 0 475752 13492 176320 0 0 0 64 116 1498 85 15 0 0 0
> 4 0 0 475752 13492 176320 0 0 0 0 107 1488 84 16 0 0 0
> 4 0 0 475752 13492 176320 0 0 0 0 140 1514 86 14 0 0 0
> 4 0 0 475752 13492 176320 0 0 0 0 107 1477 85 15 0 0 0
> 4 0 0 475752 13492 176320 0 0 0 0 122 1498 84 16 0 0 0
Did you even *look* at your own numbers? Maybe you looked at "interrpts".
The context switch numbers go from 170 per second, to 1500 per second!
If that's not "dramatically so", I don't know what is! Just how many
orders of magnitude worse does it have to be, to be "dramatic"? Apparently
one order of magnitude isn't "dramatic"?
So you were wrong. The fact that it was still "usable" is a good
indication, but how about just admitting that you were wrong, and that
renicing X is the *WRONG*THING*TO*DO*.
Just don't do it. It's wrong. It was wrong with the old schedulers, it's
wrong with the new scheduler, it's just WRONG.
It was a hack, and it's a failed hack. And the fact that you don't seem to
realize that it's a failure, even when your OWN numbers clearly show that
it's failed, is a bit scary.
Linus
^ permalink raw reply [flat|nested] 8+ messages in thread
* [report] renicing X, cfs-v5 vs sd-0.46
2007-04-22 23:24 ` Linus Torvalds
@ 2007-04-23 2:42 ` Ingo Molnar
2007-04-23 15:09 ` Linus Torvalds
0 siblings, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2007-04-23 2:42 UTC (permalink / raw)
To: Linus Torvalds
Cc: Juliusz Chroboczek, Con Kolivas, ck list, Bill Davidsen,
Willy Tarreau, William Lee Irwin III, linux-kernel,
Andrew Morton, Nick Piggin, Mike Galbraith, Arjan van de Ven,
Peter Williams, Thomas Gleixner, caglar, Gene Heskett
* Linus Torvalds <torvalds@linux-foundation.org> wrote:
> The X server should not be re-niced. It was done in the past, and it
> was wrogn then (and caused problems - we had to tell people to undo
> it, because some distros had started doing it by default).
>
> If you have a single client, the X server is *not* more important than
> the client, and indeed, renicing the X server causes bad patterns:
> just because the client sends a request does not mean that the X
> server should immediately be given the CPU as being "more important".
You are completely right in the case of traditional schedulers.
Note that this is not the case for CFS though. CFS has natural, built-in
buffering against high-rate preemptions from lower nice-level
SCHED_OTHER tasks. So while X will indeed get more CPU time (and that i
think is fully justified), it wont get nearly as high of a
context-switch rate as under priority/runqueue-based schedulers.
To demonstrate this i have done the following simple experiment: i
started 4 xterms on a single-CPU box, then i started the 'yes' utility
in each xterm and resized all of the xterms to just 2 lines vertical.
This generates a _lot_ of screen refresh events. Naturally, such a
workload utilizes the whole CPU.
Using CFS-v5, with Xorg at nice 0, the context-switch rate is low:
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
2 0 0 472132 13712 178604 0 0 0 32 113 170 83 17 0 0 0
2 0 0 472172 13712 178604 0 0 0 0 112 184 85 15 0 0 0
2 0 0 472196 13712 178604 0 0 0 0 108 162 83 17 0 0 0
1 0 0 472076 13712 178604 0 0 0 0 115 189 86 14 0 0 0
X's CPU utilization is 49%, xterm's go to 12% each. Userspace
utilization is 85%, system utilization is 15%.
Renicing X to -10 increases context-switching, but not dramatically so,
because it is throttled by CFS:
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
4 0 0 475752 13492 176320 0 0 0 64 116 1498 85 15 0 0 0
4 0 0 475752 13492 176320 0 0 0 0 107 1488 84 16 0 0 0
4 0 0 475752 13492 176320 0 0 0 0 140 1514 86 14 0 0 0
4 0 0 475752 13492 176320 0 0 0 0 107 1477 85 15 0 0 0
4 0 0 475752 13492 176320 0 0 0 0 122 1498 84 16 0 0 0
The system is still usable, Xorg is 44% busy, each xterm is 14% busy.
User utilization 85%, system utilization is 15% - just like in the first
case.
"Performance of scrolling" is exactly the same in both cases (i have
tested this by inserting periodic beeps after every 10,000 lines of text
scrolled) - but the screen refresh rate is alot more eye-pleasing in the
nice -10 case. (screen refresh it happens at ~500 Hz, while in the nice
0 case it happens at ~40 Hz and visibly flickers. This is especially
noticeable if the xterms have full size.)
I have tested the same workload on vanilla v2.6.21-rc7 and on SD-0.46
too, and they give roughly the same xterm scheduling behavior when Xorg
is at nice 0:
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
4 0 0 450564 14844 194976 0 0 0 0 287 594 58 10 32 0 0
4 0 0 450704 14844 194976 0 0 0 0 108 370 89 11 0 0 0
0 0 0 449588 14844 194976 0 0 0 0 175 434 85 13 2 0 0
3 0 0 450688 14852 194976 0 0 0 32 242 315 62 9 29 0 0
but when Xorg is reniced to -10 on the vanilla or SD schedulers, it
indeed gives the markedly higher context-switching behavior you
predicted:
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
5 0 0 452272 13936 194896 0 0 0 0 126 14147 78 22 0 0 0
4 0 0 452252 13944 194896 0 0 0 64 155 14143 80 20 0 0 0
5 0 0 452612 13944 194896 0 0 0 0 187 14031 79 21 0 0 0
4 0 0 452624 13944 194896 0 0 0 0 121 14300 82 18 0 0 0
User time drops to 78%, system time increases to 22%. "Scrolling
performance" clearly decreases.
so i agree that renicing X can be a very bad idea, but it very much
depends on the scheduler implementation too.
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-04-24 1:51 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <8c1Z0-5Lw-29@gated-at.bofh.it>
[not found] ` <8cWMV-8vr-3@gated-at.bofh.it>
[not found] ` <8d8uH-1sm-3@gated-at.bofh.it>
[not found] ` <8dawR-4zw-21@gated-at.bofh.it>
2007-04-23 18:52 ` [report] renicing X, cfs-v5 vs sd-0.46 Niel Lambrechts
2007-04-24 1:51 ` Gene Heskett
2007-04-20 14:04 [patch] CFS scheduler, v4 Ingo Molnar
2007-04-21 15:55 ` [REPORT] cfs-v4 vs sd-0.44 Con Kolivas
2007-04-21 16:00 ` Ingo Molnar
2007-04-21 23:59 ` Con Kolivas
2007-04-22 13:04 ` Juliusz Chroboczek
2007-04-22 23:24 ` Linus Torvalds
2007-04-23 2:42 ` [report] renicing X, cfs-v5 vs sd-0.46 Ingo Molnar
2007-04-23 15:09 ` Linus Torvalds
2007-04-23 17:19 ` Gene Heskett
2007-04-23 17:19 ` Gene Heskett
2007-04-23 19:48 ` Ingo Molnar
2007-04-23 20:56 ` Michael K. Edwards
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®