* Re: [PATCH] CFS: Fix missing digit off in wmult table
@ 2007-07-16 14:44 Al Boldi
0 siblings, 0 replies; 43+ messages in thread
From: Al Boldi @ 2007-07-16 14:44 UTC (permalink / raw)
To: linux-kernel
Roman Zippel wrote:
> On Mon, 16 Jul 2007, Ingo Molnar wrote:
> > to sum it up: a nice +19 task (the most commonly used nice level in
> > practice) gets 9.1%, 3.9%, 3.1% of CPU time on the old scheduler,
> > depending on the value of HZ. This is quite inconsistent and illogical.
>
> You're correct that you can find artifacts in the extreme cases, it's
> subjective whether this is a serious problem.
> It's nice that these artifacts are gone, but that still doesn't explain
> why this ratio had to be increase that much from around 1:10 to 1:69.
The ratio is definitely to high, but in addition to having a sane ratio by
default, it's probably wise to allow this to be user-configureable.
Thanks!
--
Al
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-18 16:02 ` Ingo Molnar
@ 2007-07-20 15:03 ` Roman Zippel
0 siblings, 0 replies; 43+ messages in thread
From: Roman Zippel @ 2007-07-20 15:03 UTC (permalink / raw)
To: Ingo Molnar
Cc: Peter Zijlstra, Linus Torvalds, James Bruce, Thomas Gleixner,
Mike Galbraith, Andrea Arcangeli, Andi Kleen, Andrew Morton,
linux-kernel, Arjan van de Ven, Chris Wright
Hi,
On Wed, 18 Jul 2007, Ingo Molnar wrote:
> > Why do you constantly stress level 19? Yes, that one is special, all
> > other positive levels were already relatively consistent.
>
> i constantly stress it for the reason i mentioned a good number of
> times: because it's by far the most commonly used (and complained about)
> nice level. =B-)
How do you know that? Most complained about makes most commonly used?
> but because you are asking, i'm glad to give you some first-hand
> historic background about Linux nice levels (in case you are interested)
> and the motivations behind their old and new implementations:
I guess I should be thankful now?
I'm curious why you post this now, after I "asked" about this. Most of the
information is either rather generic or not specific enough for the
problem at hand. If you had posted this information earlier, it had been
far more valueable as it could have been a nice base for a discussion.
But posting it this late I can't lose the feeling you're more interested
in "teaching" me.
> nice levels were always so weak under Linux (just read Peter's report)
-ENOLINK
> Hope this helps,
Not completely.
For negative nice levels you mentioned audio apps, but these aren't really
interested in a fair share, they would use the higher percentage only to
guarantee they get the amount of time they need independent of the
current load. I think they would be better served with e.g. a deadline
scheduler, which guarantees them an absolute time share not a relative
one.
On the other end with positive levels I more remember requests for
something closer to idle scheduling, where a process only runs when
nothing else is running.
So assuming we had scheduling classes for the above use cases, what other
reasons are left for such extreme nice levels?
My proposed nice levels have otherwise the same properties as yours (e.g.
being consistent). There is one propery you haven't commented on at all
yet. My proposed levels give the average use a far better idea what they
actually mean, i.e. that every 5 levels the process gets double/halve the
cpu time. This is IMO a considerable advantage.
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-18 16:17 ` Ingo Molnar
@ 2007-07-20 13:38 ` Roman Zippel
0 siblings, 0 replies; 43+ messages in thread
From: Roman Zippel @ 2007-07-20 13:38 UTC (permalink / raw)
To: Ingo Molnar
Cc: Matt Mackall, James Bruce, Thomas Gleixner, Mike Galbraith,
Linus Torvalds, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
Hi,
On Wed, 18 Jul 2007, Ingo Molnar wrote:
> > > [more rude insults deleted]
> > > I've been waiting for that obvious question, and i _might_ be able
> > > to answer it, but somehow it never occured to you ;-) Thanks,
>
> the ";-)" emoticon (and its contents) clearly signals this as a
> sarcastic, tongue-in-cheek remark.
To take another example why is this still insulting and inappropriate,
this is a behaviour I would characterize as school bullying:
A bully attacks someone obviously weaker than himself and for example
takes something away and than continues like "If you ask nicely I'll give
it back to you.", this often accompied by laughter to signal he's enjoying
himself and the power he has, but for the other person it's everything but
funny.
Maybe you don't know what it feels like, but I do and I can't find
anything funny, sarcastic or whatever about this, no matter how many
smileys or other tags you add there. If the communication is already that
troubled as this, such "humor" is really the worst thing you can do and I
find it rather sad that you can't realize this yourself.
> ok? (If you didnt see/read it as sarcastic straight away then my
> apologies for insulting you!)
Sorry, that is too little too late. You've apologized before and you
continued to make fun of me personally to the point of spreading wrong
information about me, which you could have very easily verified yourself,
if you only wanted.
What I want from you is that you treat me with respect and to keep your
"sarcasm" to yourself.
I told you very clearly how I think about you requoting this crap and yet
you repeat it again _twice_, so on the one hand I get this apology attempt
and on the other hand you continue to kick me in the crotch? How do you
think am I supposed to feel about this?
It's also always interesting what you don't respond to. I asked you for
examples which would prove the (rather strong) assertions you made about
me, what does it tell me now if you can't back up your statements?
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-18 12:40 ` Roman Zippel
@ 2007-07-18 16:17 ` Ingo Molnar
2007-07-20 13:38 ` Roman Zippel
0 siblings, 1 reply; 43+ messages in thread
From: Ingo Molnar @ 2007-07-18 16:17 UTC (permalink / raw)
To: Roman Zippel
Cc: Matt Mackall, James Bruce, Thomas Gleixner, Mike Galbraith,
Linus Torvalds, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
* Roman Zippel <zippel@linux-m68k.org> wrote:
> Don't make such suggestions if you have no idea how insulting they
> are. Especially the one deleted insult above where you have the
> impertinence to quote it, such tone is more appropriate between lord
> and inferior, where the latter have to make a request and the former
> "might" grant it. [...]
uhm, [and the uninterested reader might want to skip to the next mail
;-)], i'm really confused about your reply. Do you really mean this:
> > Roman, please do me a favor, and ask me the following question:
> >
> > " Ingo, you've been maintaining the scheduler for years. In fact you
> > wrote the old nice code we are talking about here. You changed it a
> > number of times since then. So you really know what's going on here.
> > Why does the old nice code behave like that for nice +19 levels? "
> >
> > I've been waiting for that obvious question, and i _might_ be able
> > to answer it, but somehow it never occured to you ;-) Thanks,
the ";-)" emoticon (and its contents) clearly signals this as a
sarcastic, tongue-in-cheek remark. To make it even clearer, please
re-read it with the <sarcastic> tag added as well for clarity:
> > <sarcastic>
> >
> > Roman, please do me a favor, and ask me the following question:
> >
> > " Ingo, you've been maintaining the scheduler for years. In fact you
> > wrote the old nice code we are talking about here. You changed it a
> > number of times since then. So you really know what's going on here.
> > Why does the old nice code behave like that for nice +19 levels? "
> >
> > I've been waiting for that obvious question, and i _might_ be able
> > to answer it, but somehow it never occured to you ;-) Thanks,
> >
> > </sarcastic>
ok? (If you didnt see/read it as sarcastic straight away then my
apologies for insulting you!)
The "_might_ be able to answer" bit is of course sarcastic too, and
contrary to your (i have to say, pretty absurd) suggestion i did not
suggest that i "might be _willing_ to answer" - which would be quite
arrogant indeed and which i never said or suggested. To make it even
clearer: i'm definitely able to answer questions about code i wrote
originally and which i just changed, were you to show genuine interest
in hearing my opinion :-)
Ingo
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-18 14:14 ` Roman Zippel
@ 2007-07-18 16:02 ` Ingo Molnar
2007-07-20 15:03 ` Roman Zippel
0 siblings, 1 reply; 43+ messages in thread
From: Ingo Molnar @ 2007-07-18 16:02 UTC (permalink / raw)
To: Roman Zippel
Cc: Peter Zijlstra, Linus Torvalds, James Bruce, Thomas Gleixner,
Mike Galbraith, Andrea Arcangeli, Andi Kleen, Andrew Morton,
linux-kernel, Arjan van de Ven, Chris Wright
* Roman Zippel <zippel@linux-m68k.org> wrote:
> > _changing_ it is an option within reason, and we've done it a couple
> > of times already in the past, and even within CFS (as Peter
> > correctly observed) we've been through a couple of iterations
> > already. And as i mentioned it before, the outer edge of nice levels
> > (+19, by far the most commonly used nice level) was inconsistent to
> > begin with: 3%, 5%, 9% of nice-0, depending on HZ.
>
> Why do you constantly stress level 19? Yes, that one is special, all
> other positive levels were already relatively consistent.
i constantly stress it for the reason i mentioned a good number of
times: because it's by far the most commonly used (and complained about)
nice level. =B-)
but because you are asking, i'm glad to give you some first-hand
historic background about Linux nice levels (in case you are interested)
and the motivations behind their old and new implementations:
nice levels were always so weak under Linux (just read Peter's report)
that people continuously bugged me about making nice +19 tasks use up
much less CPU time. Unfortunately that was not that easy to implement
(otherwise we'd have done it long ago) because nice level support was
historically coupled to timeslice length, and timeslice units were
driven by the HZ tick, so the smallest timeslice was 1/HZ.
In the O(1) scheduler (about 4 years ago) i changed negative nice levels
to be much stronger than they were before in 2.4 (and people were happy
about that change), and i also intentionally calibrated the linear
timeslice rule so that nice +19 level would be _exactly_ 1 jiffy. To
better understand it, the timeslice graph went like this (cheesy ASCII
art alert!):
A
\ | [timeslice length]
\ |
\ |
\ |
\ |
\|___100msecs
|^ . _
| ^ . _
| ^ . _
-*----------------------------------*-----> [nice level]
-20 | +19
|
|
so that if someone wants to really renice tasks, +19 would give a much
bigger hit than the normal linear rule would do. (The solution of
changing the ABI to extend priorities was discarded early on.)
This approach worked to some degree for some time, but later on with
HZ=1000 it caused 1 jiffy to be 1 msec, which meant 0.1% CPU usage which
we felt to be a bit excessive. Excessive _not_ because it's too small of
a CPU utilization, but because it causes too frequent (once per
millisec) rescheduling. (and would thus trash the cache, etc. Remember,
this was 4-5 years ago when hardware was weaker and caches were smaller,
and people were running number crunching apps at nice +19.)
So for HZ=1000 i changed nice +19 to 5msecs, because that felt like the
right minimal granularity - and this translates to 5% CPU utilization.
But the fundamental HZ-sensitive property for nice+19 still remained,
and i never got a single complaint about nice +19 being too _weak_ in
terms of CPU utilization, i only got complaints about it (still) being
way too _strong_.
To sum it up: i always wanted to make nice levels more consistent, but
within the constraints of HZ and jiffies and their nasty design level
coupling to timeslices and granularity it was not really viable.
The second (less frequent but still periodically occuring) complaint
about Linux's nice level support was its assymetry around the origo
(which you can see demonstrated in the picture above), or more
accurately: the fact that nice level behavior depended on the _absolute_
nice level as well, while the nice API itself is fundamentally
"relative":
int nice(int inc);
asmlinkage long sys_nice(int increment)
(the first one is the glibc API, the second one is the syscall API.)
Note that the 'inc' is relative to the current nice level. Tools like
bash's "nice" command mirror this relative API.
With the old scheduler, if you for example started a niced task with +1
and another task with +2, the CPU split between the two tasks would
depend on the nice level of the parent shell - if it was at nice -10 the
CPU split was different than if it was at +5 or +10.
A third complaint against Linux's nice level support was that negative
nice levels were not 'punchy enough', so lots of people had to resort to
run audio (and other multimedia) apps under RT priorities such as
SCHED_FIFO. But this caused other problems: SCHED_FIFO is not starvation
proof, and a buggy SCHED_FIFO app can also lock up the system for good.
CFS addresses all three types of complaints:
To address the first complaint (of nice levels being not "punchy"
enough), i decoupled the scheduler from 'time slice' and HZ concepts
(and made granularity a separate concept from nice levels) and thus CFS
was able to implement better and more consistent nice +19 support: now
in CFS nice +19 tasks get a HZ-independent 1.5%, instead of the variable
3%-5%-9% range they got in the old scheduler.
To address the second complaint (of nice levels not being consistent), i
made nice(1) have the same CPU utilization effect on tasks, regardless
of their absolute nice levels. So on CFS, running a nice +10 and a nice
+11 task has the same CPU utilization "split" between them as running a
nice -5 and a nice -4 task. (one will get 55% of the CPU, the other
45%.) That is why I changed nice levels to be "multiplicative" (or
exponential) - that way it does not matter which nice level you start
out from, the 'relative result' will always be the same.
The third complaint (of negative nice levels not being "punchy" enough
and forcing audio apps to run under the more dangerous SCHED_FIFO
scheduling policy) is addressed by CFS almost automatically: stronger
negative nice levels are an automatic side-effect of the recalibrated
dynamic range of nice levels.
Hope this helps,
Ingo
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-18 13:48 ` Ingo Molnar
@ 2007-07-18 14:14 ` Roman Zippel
2007-07-18 16:02 ` Ingo Molnar
0 siblings, 1 reply; 43+ messages in thread
From: Roman Zippel @ 2007-07-18 14:14 UTC (permalink / raw)
To: Ingo Molnar
Cc: Peter Zijlstra, Linus Torvalds, James Bruce, Thomas Gleixner,
Mike Galbraith, Andrea Arcangeli, Andi Kleen, Andrew Morton,
linux-kernel, Arjan van de Ven, Chris Wright
Hi,
On Wed, 18 Jul 2007, Ingo Molnar wrote:
> _changing_ it is an option within reason, and we've done it a couple of
> times already in the past, and even within CFS (as Peter correctly
> observed) we've been through a couple of iterations already. And as i
> mentioned it before, the outer edge of nice levels (+19, by far the most
> commonly used nice level) was inconsistent to begin with: 3%, 5%, 9% of
> nice-0, depending on HZ.
Why do you constantly stress level 19? Yes, that one is special, all other
positive levels were already relatively consistent.
> So changing that to a consistent (and
> user-requested)
How old is CFS and how many users did it have so far? How many users has
the old scheduler, which will be exposed to the new one soon?
> 1.5% is a much smaller change than you seem to make it
> out to be.
The percentage levels are off by a factor of upto _seven_, sorry I fail
see how you can characterize this as "small".
> So by your standard we could never change the
> scheduler. (which your ultimate argument might be after all =B-)
Careful, you make assertion about me, for which you have absolutely no
base, adding a smiley doesn't make this any funnier.
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-18 13:27 ` Peter Zijlstra
@ 2007-07-18 13:58 ` Roman Zippel
0 siblings, 0 replies; 43+ messages in thread
From: Roman Zippel @ 2007-07-18 13:58 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Linus Torvalds, Ingo Molnar, James Bruce, Thomas Gleixner,
Mike Galbraith, Andrea Arcangeli, Andi Kleen, Andrew Morton,
linux-kernel, Arjan van de Ven, Chris Wright
Hi,
On Wed, 18 Jul 2007, Peter Zijlstra wrote:
> The only expectation is that a process with a lower nice level gets more
> time. Any other expectation is a bug.
Yes, users are buggy, they expect a lot of stupid things...
Is this really reason enough to break this?
What exactly is the damage if setpriority() accepts a few more levels?
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-18 13:07 ` Roman Zippel
2007-07-18 13:27 ` Peter Zijlstra
@ 2007-07-18 13:48 ` Ingo Molnar
2007-07-18 14:14 ` Roman Zippel
1 sibling, 1 reply; 43+ messages in thread
From: Ingo Molnar @ 2007-07-18 13:48 UTC (permalink / raw)
To: Roman Zippel
Cc: Peter Zijlstra, Linus Torvalds, James Bruce, Thomas Gleixner,
Mike Galbraith, Andrea Arcangeli, Andi Kleen, Andrew Morton,
linux-kernel, Arjan van de Ven, Chris Wright
* Roman Zippel <zippel@linux-m68k.org> wrote:
> > By breaking the UNIX model of nice levels. Not an option in my book.
>
> Breaking user expectations of nice levels is?
_changing_ it is an option within reason, and we've done it a couple of
times already in the past, and even within CFS (as Peter correctly
observed) we've been through a couple of iterations already. And as i
mentioned it before, the outer edge of nice levels (+19, by far the most
commonly used nice level) was inconsistent to begin with: 3%, 5%, 9% of
nice-0, depending on HZ. So changing that to a consistent (and
user-requested) 1.5% is a much smaller change than you seem to make it
out to be. CFS itself is a far larger "change of expectations" than this
tweak to nice levels. So by your standard we could never change the
scheduler. (which your ultimate argument might be after all =B-)
Ingo
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-18 13:26 ` Roman Zippel
@ 2007-07-18 13:31 ` Peter Zijlstra
0 siblings, 0 replies; 43+ messages in thread
From: Peter Zijlstra @ 2007-07-18 13:31 UTC (permalink / raw)
To: Roman Zippel
Cc: Linus Torvalds, Ingo Molnar, James Bruce, Thomas Gleixner,
Mike Galbraith, Andrea Arcangeli, Andi Kleen, Andrew Morton,
linux-kernel, Arjan van de Ven, Chris Wright
On Wed, 2007-07-18 at 15:26 +0200, Roman Zippel wrote:
> Hi,
>
> On Wed, 18 Jul 2007, Peter Zijlstra wrote:
>
> > By breaking the UNIX model of nice levels. Not an option in my book.
>
> BTW what is the "UNIX model of nice levels"?
>
> SUS specifies the limit via NZERO, which is defined as "Minimum Acceptable
> Value: 20", I can't find any information that it must be 20.
I have never encountered a UNIX where it is anything other than 20.
Convention (alas not specification) does dictate 20.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-18 13:07 ` Roman Zippel
@ 2007-07-18 13:27 ` Peter Zijlstra
2007-07-18 13:58 ` Roman Zippel
2007-07-18 13:48 ` Ingo Molnar
1 sibling, 1 reply; 43+ messages in thread
From: Peter Zijlstra @ 2007-07-18 13:27 UTC (permalink / raw)
To: Roman Zippel
Cc: Linus Torvalds, Ingo Molnar, James Bruce, Thomas Gleixner,
Mike Galbraith, Andrea Arcangeli, Andi Kleen, Andrew Morton,
linux-kernel, Arjan van de Ven, Chris Wright
On Wed, 2007-07-18 at 15:07 +0200, Roman Zippel wrote:
> Hi,
>
> On Wed, 18 Jul 2007, Peter Zijlstra wrote:
>
> > By breaking the UNIX model of nice levels. Not an option in my book.
>
> Breaking user expectations of nice levels is?
http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html
specifically:
"3.239 Nice Value
A number used as advice to the system to alter process scheduling.
Numerically smaller values give a process additional preference when
scheduling a process to run. Numerically larger values reduce the
preference and make a process less likely to run. Typically, a process
with a smaller nice value runs to completion more quickly than an
equivalent process with a higher nice value. The symbol {NZERO}
specifies the default nice value of the system."
The only expectation is that a process with a lower nice level gets more
time. Any other expectation is a bug.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-18 12:52 ` Peter Zijlstra
2007-07-18 12:59 ` Ingo Molnar
2007-07-18 13:07 ` Roman Zippel
@ 2007-07-18 13:26 ` Roman Zippel
2007-07-18 13:31 ` Peter Zijlstra
2 siblings, 1 reply; 43+ messages in thread
From: Roman Zippel @ 2007-07-18 13:26 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Linus Torvalds, Ingo Molnar, James Bruce, Thomas Gleixner,
Mike Galbraith, Andrea Arcangeli, Andi Kleen, Andrew Morton,
linux-kernel, Arjan van de Ven, Chris Wright
Hi,
On Wed, 18 Jul 2007, Peter Zijlstra wrote:
> By breaking the UNIX model of nice levels. Not an option in my book.
BTW what is the "UNIX model of nice levels"?
SUS specifies the limit via NZERO, which is defined as "Minimum Acceptable
Value: 20", I can't find any information that it must be 20.
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-18 12:52 ` Peter Zijlstra
2007-07-18 12:59 ` Ingo Molnar
@ 2007-07-18 13:07 ` Roman Zippel
2007-07-18 13:27 ` Peter Zijlstra
2007-07-18 13:48 ` Ingo Molnar
2007-07-18 13:26 ` Roman Zippel
2 siblings, 2 replies; 43+ messages in thread
From: Roman Zippel @ 2007-07-18 13:07 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Linus Torvalds, Ingo Molnar, James Bruce, Thomas Gleixner,
Mike Galbraith, Andrea Arcangeli, Andi Kleen, Andrew Morton,
linux-kernel, Arjan van de Ven, Chris Wright
Hi,
On Wed, 18 Jul 2007, Peter Zijlstra wrote:
> By breaking the UNIX model of nice levels. Not an option in my book.
Breaking user expectations of nice levels is?
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-18 12:52 ` Peter Zijlstra
@ 2007-07-18 12:59 ` Ingo Molnar
2007-07-18 13:07 ` Roman Zippel
2007-07-18 13:26 ` Roman Zippel
2 siblings, 0 replies; 43+ messages in thread
From: Ingo Molnar @ 2007-07-18 12:59 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Roman Zippel, Linus Torvalds, James Bruce, Thomas Gleixner,
Mike Galbraith, Andrea Arcangeli, Andi Kleen, Andrew Morton,
linux-kernel, Arjan van de Ven, Chris Wright
* Peter Zijlstra <peterz@infradead.org> wrote:
> On Wed, 2007-07-18 at 14:45 +0200, Roman Zippel wrote:
> > Hi,
> >
> > On Wed, 18 Jul 2007, Peter Zijlstra wrote:
> >
> > > I actually like the extra range, it allows for a much softer punch of
> > > background tasks even on somewhat slower boxen.
> >
> > The extra range is not really a problem, in
> >
> > http://www.ussg.iu.edu/hypermail/linux/kernel/0707.2/0850.html
> >
> > I suggested how we can have both.
>
> By breaking the UNIX model of nice levels. Not an option in my book.
yeah, that's pretty much out of question.
Ingo
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-18 12:45 ` Roman Zippel
@ 2007-07-18 12:52 ` Peter Zijlstra
2007-07-18 12:59 ` Ingo Molnar
` (2 more replies)
0 siblings, 3 replies; 43+ messages in thread
From: Peter Zijlstra @ 2007-07-18 12:52 UTC (permalink / raw)
To: Roman Zippel
Cc: Linus Torvalds, Ingo Molnar, James Bruce, Thomas Gleixner,
Mike Galbraith, Andrea Arcangeli, Andi Kleen, Andrew Morton,
linux-kernel, Arjan van de Ven, Chris Wright
On Wed, 2007-07-18 at 14:45 +0200, Roman Zippel wrote:
> Hi,
>
> On Wed, 18 Jul 2007, Peter Zijlstra wrote:
>
> > I actually like the extra range, it allows for a much softer punch of
> > background tasks even on somewhat slower boxen.
>
> The extra range is not really a problem, in
>
> http://www.ussg.iu.edu/hypermail/linux/kernel/0707.2/0850.html
>
> I suggested how we can have both.
By breaking the UNIX model of nice levels. Not an option in my book.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-18 10:27 ` Peter Zijlstra
@ 2007-07-18 12:45 ` Roman Zippel
2007-07-18 12:52 ` Peter Zijlstra
0 siblings, 1 reply; 43+ messages in thread
From: Roman Zippel @ 2007-07-18 12:45 UTC (permalink / raw)
To: Peter Zijlstra
Cc: Linus Torvalds, Ingo Molnar, James Bruce, Thomas Gleixner,
Mike Galbraith, Andrea Arcangeli, Andi Kleen, Andrew Morton,
linux-kernel, Arjan van de Ven, Chris Wright
Hi,
On Wed, 18 Jul 2007, Peter Zijlstra wrote:
> I actually like the extra range, it allows for a much softer punch of
> background tasks even on somewhat slower boxen.
The extra range is not really a problem, in
http://www.ussg.iu.edu/hypermail/linux/kernel/0707.2/0850.html
I suggested how we can have both.
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-18 10:40 ` Ingo Molnar
@ 2007-07-18 12:40 ` Roman Zippel
2007-07-18 16:17 ` Ingo Molnar
0 siblings, 1 reply; 43+ messages in thread
From: Roman Zippel @ 2007-07-18 12:40 UTC (permalink / raw)
To: Ingo Molnar
Cc: Matt Mackall, James Bruce, Thomas Gleixner, Mike Galbraith,
Linus Torvalds, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
Hi,
On Wed, 18 Jul 2007, Ingo Molnar wrote:
> > > Roman, please do me a favor, and ask me the following question:
> > >
> > > [insult deleted]
> In this discussion about
> nice levels you were (very) agressively asserting things that were
> untrue,
Instead of simply asserting things, how about you provide some examples?
I made so far a single mistake of mixing up nice levels 18 and 19.
If you would point me to such examples, I could learn how to tone it down
a little, since the nice levels are not the only issue I have with the new
scheduler, the heavy stuff is still about to come. The problem here is
there is too much burnt ground so I can't just present raw ideas, which
get flamed by you, I have to be sufficiently confident they are valid,
what you might then interpret as "agressive assertion".
> you were suggesting that i dont understand the code,
Again, please point me to examples, so I at least have a chance to clear
things up, since it was never my intention to make such a suggestion, but
this gives me no chance to defend myself.
OTOH I can tell you exactly how you continuously insult me, e.g. by
suggesting I ask "stupid questions" or that I'm in "denial of facts".
Don't make such suggestions if you have no idea how insulting they are.
Especially the one deleted insult above where you have the impertinence to
quote it, such tone is more appropriate between lord and inferior, where
the latter have to make a request and the former "might" grant it.
_Never_ make me beg. :-(
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-17 14:06 ` Roman Zippel
@ 2007-07-18 10:40 ` Ingo Molnar
2007-07-18 12:40 ` Roman Zippel
0 siblings, 1 reply; 43+ messages in thread
From: Ingo Molnar @ 2007-07-18 10:40 UTC (permalink / raw)
To: Roman Zippel
Cc: Matt Mackall, James Bruce, Thomas Gleixner, Mike Galbraith,
Linus Torvalds, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
* Roman Zippel <zippel@linux-m68k.org> wrote:
> On Tue, 17 Jul 2007, Ingo Molnar wrote:
>
> > Roman, please do me a favor, and ask me the following question:
> >
> > " Ingo, you've been maintaining the scheduler for years. In fact you
> > wrote the old nice code we are talking about here. You changed it a
> > number of times since then. So you really know what's going on here.
> > Why does the old nice code behave like that for nice +19 levels? "
> >
> > I've been waiting for that obvious question, and i _might_ be able
> > to answer it, but somehow it never occured to you ;-) Thanks,
[...]
> It's obvious that you have more experience with the scheduler code,
> but does that make you unfailable? [...]
Roman, it is really not about 'experience', and yes, we all make
frequent mistakes.
it's about the plain fact that i happened to write _both_ the old and
the new code you were talking about all along. In this discussion about
nice levels you were (very) agressively asserting things that were
untrue, you were suggesting that i dont understand the code, instead of
simply asking me why the code was written in such a way and what the
motivation behind it was. I'd be glad to attempt to answer such a
friendly question, if you are interested in asking it and if you are
interested in my answer. Thanks,
Ingo
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 17:47 ` Linus Torvalds
2007-07-16 18:12 ` Roman Zippel
@ 2007-07-18 10:27 ` Peter Zijlstra
2007-07-18 12:45 ` Roman Zippel
1 sibling, 1 reply; 43+ messages in thread
From: Peter Zijlstra @ 2007-07-18 10:27 UTC (permalink / raw)
To: Linus Torvalds
Cc: Roman Zippel, Ingo Molnar, James Bruce, Thomas Gleixner,
Mike Galbraith, Andrea Arcangeli, Andi Kleen, Andrew Morton,
linux-kernel, Arjan van de Ven, Chris Wright
On Mon, 2007-07-16 at 10:47 -0700, Linus Torvalds wrote:
>
> On Mon, 16 Jul 2007, Roman Zippel wrote:
> >
> > To illustrate the problem a little different: a task with a nice level -20
> > got around 700% more cpu time (or 8 times more), now it gets 8500% more
> > cpu time (or 86.7 times more).
>
> Ingo, that _does_ sound excessive.
>
> How about trying a much less aggressive nice-level (and preferably linear,
> not exponential)?
I actually like the extra range, it allows for a much softer punch of
background tasks even on somewhat slower boxen.
I've been testing CFS on my 1200 MHz lappy for some time and a strongly
niced kbuild leaves a very usable system.
The old scheduler would leave the thing rather jumpy. And while CFS
fully fixes the jumpyness, I just did a nice +13 (which should be
equivalent to the old schedulers nice +19 for my HZ) and did a nice +19
kbuild and I can definitely feel the difference between them.
Early CFS versions had an pretty aggressive nice range (0.1% for +19),
and that has been toned down based on feedback. The current levels seem
to work well, at least on my boxen.
- Peter
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-17 7:53 ` Ingo Molnar
@ 2007-07-17 15:12 ` Roman Zippel
0 siblings, 0 replies; 43+ messages in thread
From: Roman Zippel @ 2007-07-17 15:12 UTC (permalink / raw)
To: Ingo Molnar
Cc: Matt Mackall, James Bruce, Thomas Gleixner, Mike Galbraith,
Linus Torvalds, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
Hi,
On Tue, 17 Jul 2007, Ingo Molnar wrote:
> * Roman Zippel <zippel@linux-m68k.org> wrote:
>
> > > > It's nice that these artifacts are gone, but that still doesn't
> > > > explain why this ratio had to be increase that much from around
> > > > 1:10 to 1:69.
> > >
> > > More dynamic range is better? If you actually want a task to get 20x
> > > the CPU time of another, the older scheduler doesn't really allow
> > > it.
> >
> > You can already have that, the complete range level from 19 to -20 was
> > about 1:80.
>
> But that is irrelevant: all tasks start out at nice 0, and what matters
> is the dynamic range around 0.
>
> So the dynamic range has been made uniform in the positive from
> 1:10...1:20...1:30 to 1:69 for nice +19, and from 1:8 to 1:69 in the
> minus. (with 1:86 nice -20) If you look at the negative nice levels
> alone it's a substantial increase but if you compare it with positive
> nice levels you'll similar kinds of dynamic ranges were already present
> in the old scheduler and you'll see why we've done it.
So let's look at them:
for (i=0;i<20;i++) print i, " : ", (20-i)*5, " : ", 100*1.25^-i, " : ", e(l(2)*(-i/5))*100, "\n";
0 : 100 : 100 : 100.00000000000000000000
1 : 95 : 80.00000000000000000000 : 87.05505632961241391300
2 : 90 : 64.00000000000000000000 : 75.78582832551990411700
3 : 85 : 51.20000000000000000000 : 65.97539553864471296900
4 : 80 : 40.96000000000000000000 : 57.43491774985175034000
5 : 75 : 32.76800000000000000000 : 50.00000000000000000000
6 : 70 : 26.21440000000000000000 : 43.52752816480620695700
7 : 65 : 20.97152000000000000000 : 37.89291416275995205900
8 : 60 : 16.77721600000000000000 : 32.98769776932235648400
9 : 55 : 13.42177280000000000000 : 28.71745887492587517000
10 : 50 : 10.73741824000000000000 : 25.00000000000000000000
11 : 45 : 8.58993459200000000000 : 21.76376408240310347800
12 : 40 : 6.87194767360000000000 : 18.94645708137997602900
13 : 35 : 5.49755813888000000000 : 16.49384888466117824200
14 : 30 : 4.39804651110400000000 : 14.35872943746293758500
15 : 25 : 3.51843720888320000000 : 12.50000000000000000000
16 : 20 : 2.81474976710656000000 : 10.88188204120155173900
17 : 15 : 2.25179981368524800000 : 9.47322854068998801400
18 : 10 : 1.80143985094819840000 : 8.24692444233058912100
19 : 5 : 1.44115188075855872000 : 7.17936471873146879200
(nice level : old % : new % : my suggested %)
Your levels divert very quickly from what they used to be (upto a factor
of 7), it's also not really easy to remember what the individual levels
mean.
I at least try to keep them somewhat in the range they used to be (and
the difference is limited to a factor of about 2), also every 5 levels the
amount of cpu time is halved, which is very easy to remember.
If you need more dynamic range, is there a law that prevents us from going
beyond 19? For example:
for (i=20;i<=30;i++) print i, " : ", (20-i)*5, " : ", 100*1.25^-i, " : ", e(l(2)*(-i/5))*100, "\n";
20 : 0 : 1.15292150460684697600 : 6.25000000000000000000
21 : -5 : .92233720368547758000 : 5.44094102060077586900
22 : -10 : .73786976294838206400 : 4.73661427034499400700
23 : -15 : .59029581035870565100 : 4.12346222116529456000
24 : -20 : .47223664828696452100 : 3.58968235936573439600
25 : -25 : .37778931862957161700 : 3.12500000000000000000
26 : -30 : .30223145490365729300 : 2.72047051030038793400
27 : -35 : .24178516392292583400 : 2.36830713517249700300
28 : -40 : .19342813113834066700 : 2.06173111058264728000
29 : -45 : .15474250491067253400 : 1.79484117968286719800
30 : -50 : .12379400392853802700 : 1.56250000000000000000
setpriority() accepts such values without error.
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-17 8:02 ` Ingo Molnar
@ 2007-07-17 14:06 ` Roman Zippel
2007-07-18 10:40 ` Ingo Molnar
0 siblings, 1 reply; 43+ messages in thread
From: Roman Zippel @ 2007-07-17 14:06 UTC (permalink / raw)
To: Ingo Molnar
Cc: Matt Mackall, James Bruce, Thomas Gleixner, Mike Galbraith,
Linus Torvalds, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
Hi,
On Tue, 17 Jul 2007, Ingo Molnar wrote:
> Roman, please do me a favor, and ask me the following question:
>
> " Ingo, you've been maintaining the scheduler for years. In fact you
> wrote the old nice code we are talking about here. You changed it a
> number of times since then. So you really know what's going on here.
> Why does the old nice code behave like that for nice +19 levels? "
>
> I've been waiting for that obvious question, and i _might_ be able to
> answer it, but somehow it never occured to you ;-) Thanks,
Do you have any idea how insulting and arrogant this is?
Let me translate for you, how this arrived:
"O Ingo, who art our god of the scheduler. You have blessed the paths I
walked in. You kept me from sinning numerous times. Your wisdom is
infinite. Guide me on the journey that layeth ahead of me into this world
knowledge of Your truth."
(I apologize already in advance, if I should have hurt anyones religious
feelings.)
It's obvious that you have more experience with the scheduler code, but
does that make you unfailable? Does that give you the right to act like a
jerk?
I do make mistakes, I try to learn from them and life goes on, I have no
problem with that, but what I have a problem with is if someone is abusing
this to his own advantage. I have to be extremely carful what I say to
you, because you jump on the first small mistake and I have to bear your
insults like "there's nothing i can do about your denial of facts - that
is your own private problem." I have no problems with facts, I'm only
trying very hard to ignore your arrogant behaviour...
If you have something to contribute to this discussion which might clear
things up, then just say it, but I'm not going to beg for it.
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-17 3:20 ` Roman Zippel
@ 2007-07-17 8:02 ` Ingo Molnar
2007-07-17 14:06 ` Roman Zippel
0 siblings, 1 reply; 43+ messages in thread
From: Ingo Molnar @ 2007-07-17 8:02 UTC (permalink / raw)
To: Roman Zippel
Cc: Matt Mackall, James Bruce, Thomas Gleixner, Mike Galbraith,
Linus Torvalds, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
* Roman Zippel <zippel@linux-m68k.org> wrote:
> Nice level 19 shows the largest artifacts, as that level only gets a
> single tick, so the ratio is often 1:HZ/10 (except for 1000HZ where
> it's 5:100). [...]
Roman, please do me a favor, and ask me the following question:
" Ingo, you've been maintaining the scheduler for years. In fact you
wrote the old nice code we are talking about here. You changed it a
number of times since then. So you really know what's going on here.
Why does the old nice code behave like that for nice +19 levels? "
I've been waiting for that obvious question, and i _might_ be able to
answer it, but somehow it never occured to you ;-) Thanks,
Ingo
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 21:25 ` Roman Zippel
@ 2007-07-17 7:53 ` Ingo Molnar
2007-07-17 15:12 ` Roman Zippel
0 siblings, 1 reply; 43+ messages in thread
From: Ingo Molnar @ 2007-07-17 7:53 UTC (permalink / raw)
To: Roman Zippel
Cc: Matt Mackall, James Bruce, Thomas Gleixner, Mike Galbraith,
Linus Torvalds, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
* Roman Zippel <zippel@linux-m68k.org> wrote:
> > > It's nice that these artifacts are gone, but that still doesn't
> > > explain why this ratio had to be increase that much from around
> > > 1:10 to 1:69.
> >
> > More dynamic range is better? If you actually want a task to get 20x
> > the CPU time of another, the older scheduler doesn't really allow
> > it.
>
> You can already have that, the complete range level from 19 to -20 was
> about 1:80.
But that is irrelevant: all tasks start out at nice 0, and what matters
is the dynamic range around 0.
So the dynamic range has been made uniform in the positive from
1:10...1:20...1:30 to 1:69 for nice +19, and from 1:8 to 1:69 in the
minus. (with 1:86 nice -20) If you look at the negative nice levels
alone it's a substantial increase but if you compare it with positive
nice levels you'll similar kinds of dynamic ranges were already present
in the old scheduler and you'll see why we've done it.
Negative nice levels are admin-controlled, the increase in the negative
levels is is not a big issue and people actually like the increased
dynamic range and the consistency. The positive range _might_ be a
bigger issue but there we were largely inconsistent anyway, and again,
people like the increased dynamic range.
Ingo
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-17 0:02 ` Roman Zippel
@ 2007-07-17 3:20 ` Roman Zippel
2007-07-17 8:02 ` Ingo Molnar
0 siblings, 1 reply; 43+ messages in thread
From: Roman Zippel @ 2007-07-17 3:20 UTC (permalink / raw)
To: Ingo Molnar
Cc: Matt Mackall, James Bruce, Thomas Gleixner, Mike Galbraith,
Linus Torvalds, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
Hi,
On Tue, 17 Jul 2007, I wrote:
> Playing around with some other nice levels, confirms the theory that
> something is a little off, so I'm quite correct at saying that the ratio
> _should_ be 1:10.
Rechecking everything there was actually a small error in my test program,
so the ratio should be at 1:20. Sorry about that mistake.
Nice level 19 shows the largest artifacts, as that level only gets a
single tick, so the ratio is often 1:HZ/10 (except for 1000HZ where it's
5:100). Nevertheless it's still true that in general nice levels were
independent of HZ (that's all I wanted to say a couple of mails ago).
Ingo, you can start now gloating, but contrary to you I have no problems
with admitting mistakes and apologizing for them. The point is just that
I'm reacting better to factual arguments instead of flames (and I think
it's not just me), so I'm pretty sure I'm still correct about this:
> OTOH you are the one who is wrong about me (again). :-(
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 22:29 ` Ingo Molnar
@ 2007-07-17 0:02 ` Roman Zippel
2007-07-17 3:20 ` Roman Zippel
0 siblings, 1 reply; 43+ messages in thread
From: Roman Zippel @ 2007-07-17 0:02 UTC (permalink / raw)
To: Ingo Molnar
Cc: Matt Mackall, James Bruce, Thomas Gleixner, Mike Galbraith,
Linus Torvalds, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
Hi,
On Tue, 17 Jul 2007, Ingo Molnar wrote:
> * Roman Zippel <zippel@linux-m68k.org> wrote:
>
> > Hi,
> >
> > On Mon, 16 Jul 2007, Ingo Molnar wrote:
> >
> > > and note that even on the old scheduler, nice-0 was "3200% more
> > > powerful" than nice +19 (with CONFIG_HZ=300),
> >
> > How did you get that value? At any HZ the ratio should be around 1:10
> > (+- rounding error).
>
> you are wrong again. I sent you the numbers earlier today already:
>
> | PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
> | 2332 mingo 25 0 1580 248 196 R 95.1 0.0 0:11.84 loop
> | 2335 mingo 39 19 1576 244 196 R 3.1 0.0 0:00.39 loop
>
> 3.1% is 3067% more than 95.1%, and the ratio is 1:30.67. You again deny
> above that this is the case, and there's nothing i can do about your
> denial of facts - that is your own private problem.
Ingo, how am I supposed to react to this? I'm asking a simple question
and I get this? I'm at serious loss how to deal with you. :-(
Above is based on theoritical values, for a 300HZ kernel these two
processes should get 30 and 3 ticks. Should there be any rounding error or
off by one error so that the processes get one tick less than they should
get or one tick is accounted to the wrong process, my theoritical value is
still within the possible error range and doesn't contradict your
practical values.
Playing around with some other nice levels, confirms the theory that
something is a little off, so I'm quite correct at saying that the ratio
_should_ be 1:10.
OTOH you are the one who is wrong about me (again). :-(
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 22:13 ` Roman Zippel
@ 2007-07-16 22:29 ` Ingo Molnar
2007-07-17 0:02 ` Roman Zippel
0 siblings, 1 reply; 43+ messages in thread
From: Ingo Molnar @ 2007-07-16 22:29 UTC (permalink / raw)
To: Roman Zippel
Cc: Matt Mackall, James Bruce, Thomas Gleixner, Mike Galbraith,
Linus Torvalds, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
* Roman Zippel <zippel@linux-m68k.org> wrote:
> Hi,
>
> On Mon, 16 Jul 2007, Ingo Molnar wrote:
>
> > and note that even on the old scheduler, nice-0 was "3200% more
> > powerful" than nice +19 (with CONFIG_HZ=300),
>
> How did you get that value? At any HZ the ratio should be around 1:10
> (+- rounding error).
you are wrong again. I sent you the numbers earlier today already:
| PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
| 2332 mingo 25 0 1580 248 196 R 95.1 0.0 0:11.84 loop
| 2335 mingo 39 19 1576 244 196 R 3.1 0.0 0:00.39 loop
3.1% is 3067% more than 95.1%, and the ratio is 1:30.67. You again deny
above that this is the case, and there's nothing i can do about your
denial of facts - that is your own private problem.
Ingo
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 21:18 ` Ingo Molnar
@ 2007-07-16 22:13 ` Roman Zippel
2007-07-16 22:29 ` Ingo Molnar
0 siblings, 1 reply; 43+ messages in thread
From: Roman Zippel @ 2007-07-16 22:13 UTC (permalink / raw)
To: Ingo Molnar
Cc: Matt Mackall, James Bruce, Thomas Gleixner, Mike Galbraith,
Linus Torvalds, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
Hi,
On Mon, 16 Jul 2007, Ingo Molnar wrote:
> and note that even on the old scheduler, nice-0 was "3200% more
> powerful" than nice +19 (with CONFIG_HZ=300),
How did you get that value? At any HZ the ratio should be around 1:10
(+- rounding error).
> in fact i like it that nice -20 has a slightly bigger punch than it used
> to have before:
"Slightly bigger"??? You're joking, right?
Especially the user levels are doing something completely different now,
which may break user expectation. While the user couldn't expect anything
precise, it's still a big difference whether a process at nice 5 gets 75%
of the time or only 30%.
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 20:31 ` Matt Mackall
2007-07-16 21:18 ` Ingo Molnar
@ 2007-07-16 21:25 ` Roman Zippel
2007-07-17 7:53 ` Ingo Molnar
1 sibling, 1 reply; 43+ messages in thread
From: Roman Zippel @ 2007-07-16 21:25 UTC (permalink / raw)
To: Matt Mackall
Cc: Ingo Molnar, James Bruce, Thomas Gleixner, Mike Galbraith,
Linus Torvalds, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
Hi,
On Mon, 16 Jul 2007, Matt Mackall wrote:
> > It's nice that these artifacts are gone, but that still doesn't explain
> > why this ratio had to be increase that much from around 1:10 to 1:69.
>
> More dynamic range is better? If you actually want a task to get 20x
> the CPU time of another, the older scheduler doesn't really allow it.
You can already have that, the complete range level from 19 to -20 was
about 1:80.
There is also something like too much range, I tried it with top at 19 and
as soon as something runs at -20 it's practically dead, because it gets
now only 1/5900 of cpu time.
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 20:31 ` Matt Mackall
@ 2007-07-16 21:18 ` Ingo Molnar
2007-07-16 22:13 ` Roman Zippel
2007-07-16 21:25 ` Roman Zippel
1 sibling, 1 reply; 43+ messages in thread
From: Ingo Molnar @ 2007-07-16 21:18 UTC (permalink / raw)
To: Matt Mackall
Cc: Roman Zippel, James Bruce, Thomas Gleixner, Mike Galbraith,
Linus Torvalds, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
* Matt Mackall <mpm@selenic.com> wrote:
> More dynamic range is better? If you actually want a task to get 20x
> the CPU time of another, the older scheduler doesn't really allow it.
>
> Getting 1/69th of a modern CPU is still a fair number of cycles.
> Nevermind 1/69th of a machine with > 64 cores.
yeah. furthermore, nice -20 is only admin-selectable.
Here are the current CPU-use values for positive nice levels:
nice 0: 100.00%
nice 1: 80.00%
nice 2: 64.10%
nice 3: 51.28%
nice 4: 40.98%
nice 5: 32.78%
nice 6: 26.24%
nice 7: 21.00%
nice 8: 16.77%
nice 9: 13.42%
nice 10: 10.74%
nice 11: 8.59%
nice 12: 6.87%
nice 13: 5.50%
nice 14: 4.39%
nice 15: 3.51%
nice 16: 2.81%
nice 17: 2.25%
nice 18: 1.80%
nice 19: 1.44%
here's the CPU utilization table for negative nice levels (relative to a
nice -20 task):
nice 0: 1.15%
nice -1: 1.44%
nice -2: 1.80%
nice -3: 2.25%
nice -4: 2.81%
nice -5: 3.51%
nice -6: 4.39%
nice -7: 5.50%
nice -8: 6.87%
nice -9: 8.59%
nice -10: 10.74%
nice -11: 13.42%
nice -12: 16.77%
nice -13: 21.00%
nice -14: 26.24%
nice -15: 32.78%
nice -16: 40.98%
nice -17: 51.28%
nice -18: 64.10%
nice -19: 80.00%
nice -20: 100.00%
these are pretty sane, and symmetric across the origo. Nice -20 is the
odd one out, because there is no nice +20. But its value is still
logical, it's the mirror image of an imaginery nice +20.
and note that even on the old scheduler, nice-0 was "3200% more
powerful" than nice +19 (with CONFIG_HZ=300), and nice -19 was only 700%
more powerful than nice-0. So not only was it inconsistent (and i can
create scary numbers too ;), it gave the admin-controlled negative nice
levels less of a punch than to user-controlled nice +19. A number of
people complainted about that, and CFS addresses this.
in fact i like it that nice -20 has a slightly bigger punch than it used
to have before: it might remove the need to run audio apps (and other
multimedia apps) under SCHED_FIFO. (SCHED_FIFO is unprotected against
lockups, while under CFS a nice 0 task is still starvation protected
against a nice -20 task.)
furthermore, there is a quality of implementation issue as well, look at
the definition of the nice system call:
asmlinkage long sys_nice(int increment)
the "increment" is relative. So nice(1) has the same behavioral effect
under CFS, regardless of which nice level you start out from. Under the
old scheduler, the result depended on which nice level you started out
from.
Ingo
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 14:01 ` Roman Zippel
@ 2007-07-16 20:31 ` Matt Mackall
2007-07-16 21:18 ` Ingo Molnar
2007-07-16 21:25 ` Roman Zippel
0 siblings, 2 replies; 43+ messages in thread
From: Matt Mackall @ 2007-07-16 20:31 UTC (permalink / raw)
To: Roman Zippel
Cc: Ingo Molnar, James Bruce, Thomas Gleixner, Mike Galbraith,
Linus Torvalds, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
On Mon, Jul 16, 2007 at 04:01:17PM +0200, Roman Zippel wrote:
> Hi,
>
> On Mon, 16 Jul 2007, Ingo Molnar wrote:
>
> > to sum it up: a nice +19 task (the most commonly used nice level in
> > practice) gets 9.1%, 3.9%, 3.1% of CPU time on the old scheduler,
> > depending on the value of HZ. This is quite inconsistent and illogical.
>
> You're correct that you can find artifacts in the extreme cases, it's
> subjective whether this is a serious problem.
> It's nice that these artifacts are gone, but that still doesn't explain
> why this ratio had to be increase that much from around 1:10 to 1:69.
More dynamic range is better? If you actually want a task to get 20x
the CPU time of another, the older scheduler doesn't really allow it.
Getting 1/69th of a modern CPU is still a fair number of cycles.
Nevermind 1/69th of a machine with > 64 cores.
--
Mathematics is the supreme nostalgia of our time.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 17:47 ` Linus Torvalds
@ 2007-07-16 18:12 ` Roman Zippel
2007-07-18 10:27 ` Peter Zijlstra
1 sibling, 0 replies; 43+ messages in thread
From: Roman Zippel @ 2007-07-16 18:12 UTC (permalink / raw)
To: Linus Torvalds
Cc: Ingo Molnar, James Bruce, Thomas Gleixner, Mike Galbraith,
Andrea Arcangeli, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
Hi,
On Mon, 16 Jul 2007, Linus Torvalds wrote:
> How about trying a much less aggressive nice-level (and preferably linear,
> not exponential)?
I think the exponential increase isn't the problem. The old code did
approximate something like this rather crudely with the result that there
was a big gap between level 0 and -1.
Something like this:
echo 'for (i=-20;i<=20;i++) print i, " : ", 1024*e(l(2)*(-i/20*3)), "\n";' | bc -l
would produce a range similiar to the old code. Replacing the factor 3
with 4 would be IMO a more reasonable increase and had the advantage for
the user that it's easier to understand that every 5 levels the time a
process gets is doubled.
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 11:58 ` Roman Zippel
2007-07-16 12:12 ` Ingo Molnar
@ 2007-07-16 17:47 ` Linus Torvalds
2007-07-16 18:12 ` Roman Zippel
2007-07-18 10:27 ` Peter Zijlstra
1 sibling, 2 replies; 43+ messages in thread
From: Linus Torvalds @ 2007-07-16 17:47 UTC (permalink / raw)
To: Roman Zippel
Cc: Ingo Molnar, James Bruce, Thomas Gleixner, Mike Galbraith,
Andrea Arcangeli, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
On Mon, 16 Jul 2007, Roman Zippel wrote:
>
> To illustrate the problem a little different: a task with a nice level -20
> got around 700% more cpu time (or 8 times more), now it gets 8500% more
> cpu time (or 86.7 times more).
Ingo, that _does_ sound excessive.
How about trying a much less aggressive nice-level (and preferably linear,
not exponential)?
Linus
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 7:41 ` Ingo Molnar
@ 2007-07-16 15:02 ` James Bruce
0 siblings, 0 replies; 43+ messages in thread
From: James Bruce @ 2007-07-16 15:02 UTC (permalink / raw)
To: Ingo Molnar
Cc: Thomas Gleixner, Roman Zippel, Mike Galbraith, Linus Torvalds,
Andrea Arcangeli, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
Ingo Molnar wrote:
> * Ingo Molnar <mingo@elte.hu> wrote:
>> * James Bruce <bruce@andrew.cmu.edu> wrote:
>>> While we're at it, isn't the comment above the wmult table incorrect?
>>> The multiplier is 1.25, meaning a 25% change per nice level, not 10%.
>> yes, the weight multiplier 1.25, but the actual difference in CPU
>> utilization, when running two CPU intense tasks, is ~10%:
>>
>> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
>> 8246 mingo 20 0 1576 244 196 R 55 0.0 0:11.96 loop
>> 8247 mingo 21 1 1576 244 196 R 45 0.0 0:10.52 loop
>>
>> so the first task 'wins' +10% CPU utilization (relative to the 50% it
>> had before), the second task 'loses' -10% CPU utilization (relative to
>> the 50% it had before).
>>
>> so what the comment says is true:
>>
>> * The "10% effect" is relative and cumulative: from _any_ nice level,
>> * if you go up 1 level, it's -10% CPU usage, if you go down 1 level
>> * it's +10% CPU usage.
>>
>> for there to be a ~+10% change in CPU utilization for a task that
>> races against another CPU-intense task there needs to be a ~25% change
>> in the weight.
>
> in any case more documentation is justified, so i've added some
> clarification to the comments - see the patch below.
Ah ok so it's 10% of the original CPU usage, not relative to a tasks
share from before. While I guess I still think in terms of relative CPU
share, your comments now make sense to me. Thanks for the
clarification.
- Jim
> ------------------------>
> Subject: sched: improve weight-array comments
> From: Ingo Molnar <mingo@elte.hu>
>
> improve the comments around the wmult array (which controls the weight
> of niced tasks). Clarify that to achieve a 10% difference in CPU
> utilization, a weight multiplier of 1.25 has to be used.
>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> ---
> kernel/sched.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> Index: linux/kernel/sched.c
> ===================================================================
> --- linux.orig/kernel/sched.c
> +++ linux/kernel/sched.c
> @@ -736,7 +736,9 @@ static void update_curr_load(struct rq *
> *
> * The "10% effect" is relative and cumulative: from _any_ nice level,
> * if you go up 1 level, it's -10% CPU usage, if you go down 1 level
> - * it's +10% CPU usage.
> + * it's +10% CPU usage. (to achieve that we use a multiplier of 1.25.
> + * If a task goes up by ~10% and another task goes down by ~10% then
> + * the relative distance between them is ~25%.)
> */
> static const int prio_to_weight[40] = {
> /* -20 */ 88818, 71054, 56843, 45475, 36380, 29104, 23283, 18626, 14901, 11921,
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 13:40 ` Ingo Molnar
@ 2007-07-16 14:01 ` Roman Zippel
2007-07-16 20:31 ` Matt Mackall
0 siblings, 1 reply; 43+ messages in thread
From: Roman Zippel @ 2007-07-16 14:01 UTC (permalink / raw)
To: Ingo Molnar
Cc: James Bruce, Thomas Gleixner, Mike Galbraith, Linus Torvalds,
Andi Kleen, Andrew Morton, linux-kernel, Arjan van de Ven,
Chris Wright
Hi,
On Mon, 16 Jul 2007, Ingo Molnar wrote:
> to sum it up: a nice +19 task (the most commonly used nice level in
> practice) gets 9.1%, 3.9%, 3.1% of CPU time on the old scheduler,
> depending on the value of HZ. This is quite inconsistent and illogical.
You're correct that you can find artifacts in the extreme cases, it's
subjective whether this is a serious problem.
It's nice that these artifacts are gone, but that still doesn't explain
why this ratio had to be increase that much from around 1:10 to 1:69.
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 12:42 ` Roman Zippel
@ 2007-07-16 13:40 ` Ingo Molnar
2007-07-16 14:01 ` Roman Zippel
0 siblings, 1 reply; 43+ messages in thread
From: Ingo Molnar @ 2007-07-16 13:40 UTC (permalink / raw)
To: Roman Zippel
Cc: James Bruce, Thomas Gleixner, Mike Galbraith, Linus Torvalds,
Andi Kleen, Andrew Morton, linux-kernel, Arjan van de Ven,
Chris Wright
* Roman Zippel <zippel@linux-m68k.org> wrote:
> > It has been a common request for nice levels to be more logical
> > (i.e. to make them universal and to detach them from HZ) and for
> > them to be more effective as well.
>
> Huh? What has this to do with HZ? The scheduler used ticks internally,
> but it's irrelevant to what the user sees via the nice levels. [...]
unfortunately you are wrong again - there are various HZ related
artifacts in the nice level support code of the old scheduler.
v2.6.22, CONFIG_HZ=100, nice +19 task against a nice-0 CPU-intense task:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2446 mingo 25 0 1576 244 196 R 90.9 0.0 0:32.79 loop
2448 mingo 39 19 1580 248 196 R 9.1 0.0 0:02.94 loop
v2.6.22, CONFIG_HZ=250, nice +19 task against a nice-0 CPU-intense task:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2358 mingo 25 0 1576 248 196 R 96.1 0.0 0:31.97 loop_silent
2363 mingo 39 19 1576 244 196 R 3.9 0.0 0:01.24 loop_silent
v2.6.22, CONFIG_HZ=300, nice +19 task against a nice-0 CPU-intense task:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2332 mingo 25 0 1580 248 196 R 95.1 0.0 0:11.84 loop_silent
2335 mingo 39 19 1576 244 196 R 3.1 0.0 0:00.39 loop_silent
to sum it up: a nice +19 task (the most commonly used nice level in
practice) gets 9.1%, 3.9%, 3.1% of CPU time on the old scheduler,
depending on the value of HZ. This is quite inconsistent and illogical.
this HZ dependency of nice levels existed for many years, and the new
scheduler solves that inconsistency - every nice level will get the same
amount of time, regardless of HZ.
Ingo
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 12:12 ` Ingo Molnar
@ 2007-07-16 12:42 ` Roman Zippel
2007-07-16 13:40 ` Ingo Molnar
0 siblings, 1 reply; 43+ messages in thread
From: Roman Zippel @ 2007-07-16 12:42 UTC (permalink / raw)
To: Ingo Molnar
Cc: James Bruce, Thomas Gleixner, Mike Galbraith, Linus Torvalds,
Andrea Arcangeli, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
Hi,
On Mon, 16 Jul 2007, Ingo Molnar wrote:
> > > > As soon as you add another loop the difference changes again,
> > > > while it's always correct to say it gets 25% more cpu time [...]
> > >
> > > yep, and i'll add the relative effect to the comment too.
> >
> > Why did you cut off the rest of the sentence?
>
> (no need to become hostile, i answered to that portion of your sentence
> separately, which was logically detached from the other portion of your
> sentence. I marked the cut with the '[...]' sign. )
Could you please stop with these accusations?
Could you please point me to the mail with the separate answer?
> > To illustrate the problem a little different: a task with a nice level
> > -20 got around 700% more cpu time (or 8 times more), now it gets 8500%
> > more cpu time (or 86.7 times more). You don't think that change to the
> > nice levels is a little drastic?
>
> This was discussed on lkml in detail, see the CFS threads.
Which are quite big, so I skipped most of it, a more precise pointer would
be appreciated.
> It has been a
> common request for nice levels to be more logical (i.e. to make them
> universal and to detach them from HZ) and for them to be more effective
> as well.
Huh? What has this to do with HZ? The scheduler used ticks internally, but
it's irrelevant to what the user sees via the nice levels.
So the question still stands that this change may be a little drastic, as
you changed the nice levels of _all_ users, not just of those who were
previously interested in CFS.
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 11:58 ` Roman Zippel
@ 2007-07-16 12:12 ` Ingo Molnar
2007-07-16 12:42 ` Roman Zippel
2007-07-16 17:47 ` Linus Torvalds
1 sibling, 1 reply; 43+ messages in thread
From: Ingo Molnar @ 2007-07-16 12:12 UTC (permalink / raw)
To: Roman Zippel
Cc: James Bruce, Thomas Gleixner, Mike Galbraith, Linus Torvalds,
Andrea Arcangeli, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
* Roman Zippel <zippel@linux-m68k.org> wrote:
> On Mon, 16 Jul 2007, Ingo Molnar wrote:
>
> > > As soon as you add another loop the difference changes again,
> > > while it's always correct to say it gets 25% more cpu time [...]
> >
> > yep, and i'll add the relative effect to the comment too.
>
> Why did you cut off the rest of the sentence?
(no need to become hostile, i answered to that portion of your sentence
separately, which was logically detached from the other portion of your
sentence. I marked the cut with the '[...]' sign. )
> To illustrate the problem a little different: a task with a nice level
> -20 got around 700% more cpu time (or 8 times more), now it gets 8500%
> more cpu time (or 86.7 times more). You don't think that change to the
> nice levels is a little drastic?
This was discussed on lkml in detail, see the CFS threads. It has been a
common request for nice levels to be more logical (i.e. to make them
universal and to detach them from HZ) and for them to be more effective
as well.
Ingo
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 11:20 ` Ingo Molnar
@ 2007-07-16 11:58 ` Roman Zippel
2007-07-16 12:12 ` Ingo Molnar
2007-07-16 17:47 ` Linus Torvalds
0 siblings, 2 replies; 43+ messages in thread
From: Roman Zippel @ 2007-07-16 11:58 UTC (permalink / raw)
To: Ingo Molnar
Cc: James Bruce, Thomas Gleixner, Mike Galbraith, Linus Torvalds,
Andrea Arcangeli, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
Hi,
On Mon, 16 Jul 2007, Ingo Molnar wrote:
> > As soon as you add another loop the difference changes again, while
> > it's always correct to say it gets 25% more cpu time [...]
>
> yep, and i'll add the relative effect to the comment too.
Why did you cut off the rest of the sentence?
To illustrate the problem a little different: a task with a nice level -20
got around 700% more cpu time (or 8 times more), now it gets 8500% more
cpu time (or 86.7 times more).
You don't think that change to the nice levels is a little drastic?
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 10:18 ` Roman Zippel
@ 2007-07-16 11:20 ` Ingo Molnar
2007-07-16 11:58 ` Roman Zippel
0 siblings, 1 reply; 43+ messages in thread
From: Ingo Molnar @ 2007-07-16 11:20 UTC (permalink / raw)
To: Roman Zippel
Cc: James Bruce, Thomas Gleixner, Mike Galbraith, Linus Torvalds,
Andrea Arcangeli, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
* Roman Zippel <zippel@linux-m68k.org> wrote:
> > yes, the weight multiplier 1.25, but the actual difference in CPU
> > utilization, when running two CPU intense tasks, is ~10%:
> >
> > PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
> > 8246 mingo 20 0 1576 244 196 R 55 0.0 0:11.96 loop
> > 8247 mingo 21 1 1576 244 196 R 45 0.0 0:10.52 loop
> >
> > so the first task 'wins' +10% CPU utilization (relative to the 50%
> > it had before), the second task 'loses' -10% CPU utilization
> > (relative to the 50% it had before).
>
> As soon as you add another loop the difference changes again, while
> it's always correct to say it gets 25% more cpu time [...]
yep, and i'll add the relative effect to the comment too.
Ingo
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 7:06 ` Ingo Molnar
2007-07-16 7:41 ` Ingo Molnar
@ 2007-07-16 10:18 ` Roman Zippel
2007-07-16 11:20 ` Ingo Molnar
1 sibling, 1 reply; 43+ messages in thread
From: Roman Zippel @ 2007-07-16 10:18 UTC (permalink / raw)
To: Ingo Molnar
Cc: James Bruce, Thomas Gleixner, Mike Galbraith, Linus Torvalds,
Andrea Arcangeli, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
Hi,
On Mon, 16 Jul 2007, Ingo Molnar wrote:
> yes, the weight multiplier 1.25, but the actual difference in CPU
> utilization, when running two CPU intense tasks, is ~10%:
>
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
> 8246 mingo 20 0 1576 244 196 R 55 0.0 0:11.96 loop
> 8247 mingo 21 1 1576 244 196 R 45 0.0 0:10.52 loop
>
> so the first task 'wins' +10% CPU utilization (relative to the 50% it
> had before), the second task 'loses' -10% CPU utilization (relative to
> the 50% it had before).
As soon as you add another loop the difference changes again, while it's
always correct to say it gets 25% more cpu time (which I still think is a
little too much).
bye, Roman
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 7:06 ` Ingo Molnar
@ 2007-07-16 7:41 ` Ingo Molnar
2007-07-16 15:02 ` James Bruce
2007-07-16 10:18 ` Roman Zippel
1 sibling, 1 reply; 43+ messages in thread
From: Ingo Molnar @ 2007-07-16 7:41 UTC (permalink / raw)
To: James Bruce
Cc: Thomas Gleixner, Roman Zippel, Mike Galbraith, Linus Torvalds,
Andrea Arcangeli, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
* Ingo Molnar <mingo@elte.hu> wrote:
> * James Bruce <bruce@andrew.cmu.edu> wrote:
>
> > While we're at it, isn't the comment above the wmult table incorrect?
> > The multiplier is 1.25, meaning a 25% change per nice level, not 10%.
>
> yes, the weight multiplier 1.25, but the actual difference in CPU
> utilization, when running two CPU intense tasks, is ~10%:
>
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
> 8246 mingo 20 0 1576 244 196 R 55 0.0 0:11.96 loop
> 8247 mingo 21 1 1576 244 196 R 45 0.0 0:10.52 loop
>
> so the first task 'wins' +10% CPU utilization (relative to the 50% it
> had before), the second task 'loses' -10% CPU utilization (relative to
> the 50% it had before).
>
> so what the comment says is true:
>
> * The "10% effect" is relative and cumulative: from _any_ nice level,
> * if you go up 1 level, it's -10% CPU usage, if you go down 1 level
> * it's +10% CPU usage.
>
> for there to be a ~+10% change in CPU utilization for a task that
> races against another CPU-intense task there needs to be a ~25% change
> in the weight.
in any case more documentation is justified, so i've added some
clarification to the comments - see the patch below.
Ingo
------------------------>
Subject: sched: improve weight-array comments
From: Ingo Molnar <mingo@elte.hu>
improve the comments around the wmult array (which controls the weight
of niced tasks). Clarify that to achieve a 10% difference in CPU
utilization, a weight multiplier of 1.25 has to be used.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/sched.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: linux/kernel/sched.c
===================================================================
--- linux.orig/kernel/sched.c
+++ linux/kernel/sched.c
@@ -736,7 +736,9 @@ static void update_curr_load(struct rq *
*
* The "10% effect" is relative and cumulative: from _any_ nice level,
* if you go up 1 level, it's -10% CPU usage, if you go down 1 level
- * it's +10% CPU usage.
+ * it's +10% CPU usage. (to achieve that we use a multiplier of 1.25.
+ * If a task goes up by ~10% and another task goes down by ~10% then
+ * the relative distance between them is ~25%.)
*/
static const int prio_to_weight[40] = {
/* -20 */ 88818, 71054, 56843, 45475, 36380, 29104, 23283, 18626, 14901, 11921,
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-16 6:18 ` James Bruce
@ 2007-07-16 7:06 ` Ingo Molnar
2007-07-16 7:41 ` Ingo Molnar
2007-07-16 10:18 ` Roman Zippel
0 siblings, 2 replies; 43+ messages in thread
From: Ingo Molnar @ 2007-07-16 7:06 UTC (permalink / raw)
To: James Bruce
Cc: Thomas Gleixner, Roman Zippel, Mike Galbraith, Linus Torvalds,
Andrea Arcangeli, Andi Kleen, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
* James Bruce <bruce@andrew.cmu.edu> wrote:
> While we're at it, isn't the comment above the wmult table incorrect?
> The multiplier is 1.25, meaning a 25% change per nice level, not 10%.
yes, the weight multiplier 1.25, but the actual difference in CPU
utilization, when running two CPU intense tasks, is ~10%:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
8246 mingo 20 0 1576 244 196 R 55 0.0 0:11.96 loop
8247 mingo 21 1 1576 244 196 R 45 0.0 0:10.52 loop
so the first task 'wins' +10% CPU utilization (relative to the 50% it
had before), the second task 'loses' -10% CPU utilization (relative to
the 50% it had before).
so what the comment says is true:
* The "10% effect" is relative and cumulative: from _any_ nice level,
* if you go up 1 level, it's -10% CPU usage, if you go down 1 level
* it's +10% CPU usage.
for there to be a ~+10% change in CPU utilization for a task that races
against another CPU-intense task there needs to be a ~25% change in the
weight.
Ingo
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] CFS: Fix missing digit off in wmult table
2007-07-13 19:43 ` [PATCH] CFS: Fix missing digit off in wmult table Thomas Gleixner
@ 2007-07-16 6:18 ` James Bruce
2007-07-16 7:06 ` Ingo Molnar
0 siblings, 1 reply; 43+ messages in thread
From: James Bruce @ 2007-07-16 6:18 UTC (permalink / raw)
To: linux-kernel
Cc: Roman Zippel, Mike Galbraith, Linus Torvalds, Andrea Arcangeli,
Andi Kleen, Ingo Molnar, Andrew Morton, linux-kernel,
Arjan van de Ven, Chris Wright
Thomas Gleixner wrote:
> Roman Zippel noticed inconsistency of the wmult table.
> wmult[16] has a missing digit.
[snip]
While we're at it, isn't the comment above the wmult table incorrect?
The multiplier is 1.25, meaning a 25% change per nice level, not 10%.
- Jim
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH] CFS: Fix missing digit off in wmult table
2007-07-13 17:23 ` Roman Zippel
@ 2007-07-13 19:43 ` Thomas Gleixner
2007-07-16 6:18 ` James Bruce
0 siblings, 1 reply; 43+ messages in thread
From: Thomas Gleixner @ 2007-07-13 19:43 UTC (permalink / raw)
To: Roman Zippel
Cc: Mike Galbraith, Linus Torvalds, Andrea Arcangeli, Andi Kleen,
Ingo Molnar, Andrew Morton, linux-kernel, Arjan van de Ven,
Chris Wright
Roman Zippel noticed inconsistency of the wmult table.
wmult[16] has a missing digit.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
diff --git a/kernel/sched.c b/kernel/sched.c
index 0559665..3332bbb 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -750,7 +750,7 @@ static const u32 prio_to_wmult[40] = {
48356, 60446, 75558, 94446, 118058, 147573,
184467, 230589, 288233, 360285, 450347,
562979, 703746, 879575, 1099582, 1374389,
- 717986, 2147483, 2684354, 3355443, 4194304,
+ 1717986, 2147483, 2684354, 3355443, 4194304,
5244160, 6557201, 8196502, 10250518, 12782640,
16025997, 19976592, 24970740, 31350126, 39045157,
49367440, 61356675, 76695844, 95443717, 119304647,
^ permalink raw reply [flat|nested] 43+ messages in thread
end of thread, other threads:[~2007-07-20 15:04 UTC | newest]
Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-16 14:44 [PATCH] CFS: Fix missing digit off in wmult table Al Boldi
-- strict thread matches above, loose matches on Subject: below --
2007-07-10 8:31 -mm merge plans for 2.6.23 Andrew Morton
2007-07-11 12:43 ` x86 status was " Andi Kleen
2007-07-11 17:42 ` Ingo Molnar
2007-07-11 21:16 ` Andi Kleen
2007-07-11 21:46 ` Andrea Arcangeli
2007-07-11 22:09 ` Linus Torvalds
2007-07-13 2:23 ` Roman Zippel
2007-07-13 4:47 ` Mike Galbraith
2007-07-13 17:23 ` Roman Zippel
2007-07-13 19:43 ` [PATCH] CFS: Fix missing digit off in wmult table Thomas Gleixner
2007-07-16 6:18 ` James Bruce
2007-07-16 7:06 ` Ingo Molnar
2007-07-16 7:41 ` Ingo Molnar
2007-07-16 15:02 ` James Bruce
2007-07-16 10:18 ` Roman Zippel
2007-07-16 11:20 ` Ingo Molnar
2007-07-16 11:58 ` Roman Zippel
2007-07-16 12:12 ` Ingo Molnar
2007-07-16 12:42 ` Roman Zippel
2007-07-16 13:40 ` Ingo Molnar
2007-07-16 14:01 ` Roman Zippel
2007-07-16 20:31 ` Matt Mackall
2007-07-16 21:18 ` Ingo Molnar
2007-07-16 22:13 ` Roman Zippel
2007-07-16 22:29 ` Ingo Molnar
2007-07-17 0:02 ` Roman Zippel
2007-07-17 3:20 ` Roman Zippel
2007-07-17 8:02 ` Ingo Molnar
2007-07-17 14:06 ` Roman Zippel
2007-07-18 10:40 ` Ingo Molnar
2007-07-18 12:40 ` Roman Zippel
2007-07-18 16:17 ` Ingo Molnar
2007-07-20 13:38 ` Roman Zippel
2007-07-16 21:25 ` Roman Zippel
2007-07-17 7:53 ` Ingo Molnar
2007-07-17 15:12 ` Roman Zippel
2007-07-16 17:47 ` Linus Torvalds
2007-07-16 18:12 ` Roman Zippel
2007-07-18 10:27 ` Peter Zijlstra
2007-07-18 12:45 ` Roman Zippel
2007-07-18 12:52 ` Peter Zijlstra
2007-07-18 12:59 ` Ingo Molnar
2007-07-18 13:07 ` Roman Zippel
2007-07-18 13:27 ` Peter Zijlstra
2007-07-18 13:58 ` Roman Zippel
2007-07-18 13:48 ` Ingo Molnar
2007-07-18 14:14 ` Roman Zippel
2007-07-18 16:02 ` Ingo Molnar
2007-07-20 15:03 ` Roman Zippel
2007-07-18 13:26 ` Roman Zippel
2007-07-18 13:31 ` Peter Zijlstra
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®