Re: [ANNOUNCE/RFC] Really Simple Really Fair Scheduler

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ingo Molnar
Date: Sunday, September 2, 2007 - 12:44 pm

* Tong Li <tong.n.li@intel.com> wrote:


yeah. Note that just in case i wasnt clear enough: my patch attempts to 
be an adoption of the core fairness math algorithm Roman suggested - so 
it is not my idea and i dont want to take credit for it. (if it were to 
go upstream it would of course carry a prominent "fairness math 
rewritten by Roman Zippel" credit.)

about O(log N) complexity: the "timeline" nature of the CFS rbtree 
(which rbtree Roman's patch preserves) guarantees a certain good level 
of cache locality. We generally insert tasks at the "right side" of the 
tree and remove them from the "left side" of the tree. (not always of 
course, but for most workloads) So in practice, on a reasonable CPU, 
there's no difference to the cachemiss patterns of pure O(1) algorithms. 
And in terms of cycle overhead, lets consider something really extreme: 
_one million runnable tasks on a single CPU_ (which is clearly silly and 
unrealistic), which has a worst-case rbtree depth of ~31. A modern CPU 
can walk a 31-deep binary tree in the neighborhood of 100 cycles 
(cached). That makes it comparable to the O(1) scheduler's reliance on 
the BSF instruction on x86 (which instruction costs a few dozen cycles 
last i remember). In practice O(log(N)) algorithms are really equivalent 
to O(1) algorithms. The big thing about the "O(1) scheduler" was that 
the scheduler it replaced was O(N). Now an O(N) algorithm _does_ hurt.

No doubt, people _will_ play with CFS and will try to implement its 
timeline data structure using O(1) algorithms (or improved tree 
algorithms). It's doable and it will certainly be interesting to see the 
results of such experiments. The rbtree was simply the most natural 
choice of an already existing, lightweight in-kernel tree data 
structure. [ It's also used by the MM so continued sanity and 
performance of that code is guaranteed by the MM hackers ;-) ]



yep. The code i posted treats all tasks as nice-0. I suspect by adding a 
calc_weighted() transformation to the key calculation above we'd get 
most of the nice level support. (but i havent tried that yet - i was 
mainly interested in a simple expression of Roman's ideas)


it's i think what Roman's algorithm does, and i wanted to implement that 
and only that, to be able to review the effects of a much simpler, yet 
behaviorally equivalent patch. Perhaps Roman can shed some light on what 
the thinking behind that average is.

	Ingo
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[ANNOUNCE/RFC] Really Simple Really Fair Scheduler, Ingo Molnar, (Sun Sep 2, 5:01 am)
Re: [ANNOUNCE/RFC] Really Simple Really Fair Scheduler, Ingo Molnar, (Sun Sep 2, 12:44 pm)
Re: [ANNOUNCE/RFC] Really Simple Really Fair Scheduler, Roman Zippel, (Mon Sep 3, 11:38 am)
Re: [ANNOUNCE/RFC] Really Simple Really Fair Scheduler, Ingo Molnar, (Mon Sep 3, 11:54 am)
Re: [ANNOUNCE/RFC] Really Simple Really Fair Scheduler, Roman Zippel, (Mon Sep 3, 12:13 pm)
Re: [ANNOUNCE/RFC] Really Simple Really Fair Scheduler, Ingo Molnar, (Mon Sep 3, 12:20 pm)
Re: [ANNOUNCE/RFC] Really Simple Really Fair Scheduler, Roman Zippel, (Mon Sep 3, 12:55 pm)
Re: [ANNOUNCE/RFC] Really Simple Really Fair Scheduler, Roman Zippel, (Mon Sep 3, 7:50 pm)
Re: [ANNOUNCE/RFC] Really Simple Really Fair Scheduler, Ingo Molnar, (Mon Sep 3, 11:29 pm)
Re: [ANNOUNCE/RFC] Really Simple Really Fair Scheduler, Roman Zippel, (Tue Sep 4, 4:21 am)