Re: [Announce] [patch] Modular Scheduler Core and Completely Fair Scheduler [CFS]

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Peter Williams
Date: Tuesday, April 17, 2007 - 6:44 am

Ingo Molnar wrote:

At this point I'd like to make the observation that spa_ebs is a very 
fair scheduler if you consider "nice" to be an indication of the 
relative entitlement of tasks to CPU bandwidth.

It works by mapping nice to shares using a function very similar to the 
one for calculating p->load weight except it's not offset by the RT 
priorities as RT is handled separately.  In theory, a runnable task's 
entitlement to CPU bandwidth at any time is the ratio of its shares to 
the total shares held by runnable tasks on the same CPU (in reality, a 
smoothed average of this sum is used to make scheduling smoother).  The 
dynamic priorities of the runnable tasks are then fiddled to try to keep 
each tasks CPU bandwidth usage in proportion to its entitlement.

That's the theory anyway.

The actual implementation looks a bit different due to efficiency 
considerations.  The modifications to the above theory boil down to 
keeping a running measure of the (recent) highest CPU bandwidth use per 
share for tasks running on the CPU -- I call this the yardstick for this 
CPU.  When it's time to put a task on the run queue it's dynamic 
priority is determined by comparing its CPU bandwidth per share value 
with the yardstick for its CPU.  If it's greater than the yardstick this 
value becomes the new yardstick and the task gets given the lowest 
possible dynamic priority (for its scheduling class).  If the value is 
zero it gets the highest possible priority (for its scheduling class) 
which would be MAX_RT_PRIO for a SCHED_OTHER task.  Otherwise it gets 
given a priority between these two extremes proportional to ratio of its 
CPU bandwidth per share value and the yardstick.  Quite simple really.

The other way in which the code deviates from the original as that (for 
a few years now) I no longer calculated CPU bandwidth usage directly. 
I've found that the overhead is less if I keep a running average of the 
size of a tasks CPU bursts and the length of its scheduling cycle (i.e. 
from on CPU one time to on CPU next time) and using the ratio of these 
values as a measure of bandwidth usage.

Anyway it works and gives very predictable allocations of CPU bandwidth 
based on nice.

Another good feature is that (in this pure form) it's starvation free. 
However, if you fiddle with it and do things like giving bonus priority 
boosts to interactive tasks it becomes susceptible to starvation.  This 
can be fixed by using an anti starvation mechanism such as SPA's 
promotion scheme and that's what spa_ebs does.

Peter
-- 
Peter Williams                                   pwil3058@bigpond.net.au

"Learning, n. The kind of ignorance distinguishing the studious."
  -- Ambrose Bierce
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Fri Apr 13, 2:21 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., Michal Piotrowski, (Fri Apr 13, 2:57 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Fri Apr 13, 3:21 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Fri Apr 13, 4:30 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Fri Apr 13, 4:58 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., Eric W. Biederman, (Sat Apr 14, 10:15 am)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., Eric W. Biederman, (Sat Apr 14, 10:44 am)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., Eric W. Biederman, (Sat Apr 14, 11:40 am)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Sat Apr 14, 12:48 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Sat Apr 14, 9:01 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Sun Apr 15, 8:26 am)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Sun Apr 15, 8:47 am)
Re: Kaffeine problem with CFS, Ingo Molnar, (Sun Apr 15, 9:13 am)
Re: Kaffeine problem with CFS, Ingo Molnar, (Sun Apr 15, 9:25 am)
Re: Kaffeine problem with CFS, Christoph Pfister, (Sun Apr 15, 9:55 am)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., Jonathan Lundell, (Sun Apr 15, 12:00 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Sun Apr 15, 12:35 pm)
Re: Kaffeine problem with CFS, S.Çağlar, (Sun Apr 15, 3:14 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Sun Apr 15, 4:39 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Sun Apr 15, 4:54 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Sun Apr 15, 8:04 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Mon Apr 16, 4:04 am)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Mon Apr 16, 6:46 am)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Mon Apr 16, 8:45 am)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Mon Apr 16, 9:13 am)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., Michael K. Edwards, (Mon Apr 16, 4:10 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Mon Apr 16, 11:09 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Mon Apr 16, 11:14 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Mon Apr 16, 11:26 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Tue Apr 17, 12:09 am)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Tue Apr 17, 1:23 am)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Tue Apr 17, 1:24 am)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Tue Apr 17, 2:05 am)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Tue Apr 17, 2:57 am)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Tue Apr 17, 4:31 am)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., Peter Williams, (Tue Apr 17, 6:44 am)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Tue Apr 17, 1:05 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Tue Apr 17, 3:32 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., Michael K. Edwards, (Tue Apr 17, 4:00 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Tue Apr 17, 4:07 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., Michael K. Edwards, (Tue Apr 17, 4:52 pm)
Re: Kaffeine problem with CFS, Ingo Molnar, (Wed Apr 18, 1:27 am)
Re: Kaffeine problem with CFS, Ingo Molnar, (Wed Apr 18, 1:57 am)
Re: Kaffeine problem with CFS, Christoph Pfister, (Wed Apr 18, 1:57 am)
Re: Kaffeine problem with CFS, Ingo Molnar, (Wed Apr 18, 2:01 am)
Re: Kaffeine problem with CFS, Ingo Molnar, (Wed Apr 18, 2:06 am)
Re: Kaffeine problem with CFS, Mike Galbraith, (Wed Apr 18, 2:12 am)
Re: Kaffeine problem with CFS, Christoph Pfister, (Wed Apr 18, 2:13 am)
Re: Kaffeine problem with CFS, Ingo Molnar, (Wed Apr 18, 2:17 am)
Re: Kaffeine problem with CFS, Christoph Pfister, (Wed Apr 18, 2:25 am)
Re: Kaffeine problem with CFS, Ingo Molnar, (Wed Apr 18, 2:28 am)
Re: Kaffeine problem with CFS, Christoph Pfister, (Wed Apr 18, 2:52 am)
Re: Kaffeine problem with CFS, Christoph Pfister, (Wed Apr 18, 3:04 am)
Re: Kaffeine problem with CFS, Ingo Molnar, (Wed Apr 18, 3:17 am)
Re: Kaffeine problem with CFS, Ingo Molnar, (Wed Apr 18, 3:32 am)
Re: Kaffeine problem with CFS, Ingo Molnar, (Wed Apr 18, 3:37 am)
Re: Kaffeine problem with CFS, Ingo Molnar, (Wed Apr 18, 3:49 am)
Re: Kaffeine problem with CFS, Ingo Molnar, (Wed Apr 18, 3:53 am)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Wed Apr 18, 6:08 am)
Re: CFS and suspend2: hang in atomic copy, Christian Hesse, (Wed Apr 18, 1:45 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Thu Apr 19, 12:57 am)
Renice X for cpu schedulers, Con Kolivas, (Thu Apr 19, 4:59 am)
Re: Renice X for cpu schedulers, Peter Williams, (Thu Apr 19, 5:42 am)
Re: Renice X for cpu schedulers, Mark Lord, (Thu Apr 19, 6:17 am)
Re: Renice X for cpu schedulers, Con Kolivas, (Thu Apr 19, 8:10 am)
Re: Renice X for cpu schedulers, Mark Lord, (Thu Apr 19, 9:15 am)
Re: Renice X for cpu schedulers, Gene Heskett, (Thu Apr 19, 11:16 am)
Re: Renice X for cpu schedulers, Gene Heskett, (Thu Apr 19, 11:21 am)
Re: Renice X for cpu schedulers, Ray Lee, (Thu Apr 19, 12:26 pm)
Re: Renice X for cpu schedulers, Michael K. Edwards, (Thu Apr 19, 2:35 pm)
Re: Renice X for cpu schedulers, Con Kolivas, (Thu Apr 19, 3:47 pm)
Re: Renice X for cpu schedulers, Con Kolivas, (Thu Apr 19, 3:56 pm)
Re: Renice X for cpu schedulers, Con Kolivas, (Thu Apr 19, 5:17 pm)
Re: Renice X for cpu schedulers, Michael K. Edwards, (Thu Apr 19, 5:20 pm)
Re: Renice X for cpu schedulers, Ray Lee, (Thu Apr 19, 5:56 pm)
Re: Renice X for cpu schedulers, Ed Tomlinson, (Thu Apr 19, 6:17 pm)
Re: Renice X for cpu schedulers, Linus Torvalds, (Thu Apr 19, 6:27 pm)
Re: Renice X for cpu schedulers, Gene Heskett, (Thu Apr 19, 7:00 pm)
Re: Renice X for cpu schedulers, Gene Heskett, (Thu Apr 19, 7:01 pm)
Re: Renice X for cpu schedulers, Nick Piggin, (Thu Apr 19, 8:57 pm)
Re: Renice X for cpu schedulers, Nick Piggin, (Thu Apr 19, 9:09 pm)
Re: Renice X for cpu schedulers, Mike Galbraith, (Thu Apr 19, 10:24 pm)
Re: [Announce] [patch] Modular Scheduler Core and Complete ..., William Lee Irwin III, (Thu Apr 19, 10:26 pm)
Re: Renice X for cpu schedulers, Bill Huey, (Thu Apr 19, 10:34 pm)
Re: Renice X for cpu schedulers, Mark Lord, (Sat Apr 21, 7:55 am)
Re: Renice X for cpu schedulers, Mark Lord, (Sun Apr 22, 5:54 am)
Re: Renice X for cpu schedulers, Con Kolivas, (Sun Apr 22, 5:58 am)
Re: Renice X for cpu schedulers, Ray Lee, (Tue Apr 24, 8:50 am)
Re: Renice X for cpu schedulers, Matt Mackall, (Tue Apr 24, 9:23 am)