Skip to contentSkip to conversation

CFS scheduler: documentation about scheduling policies

PATCH Applied Martin Steigerwald 3 participants 9 messages Sep 23, 2008 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CFS scheduler: documentation about scheduling policies

The documentation about the CFS scheduler is scarse when it comes to scheduling policies. This patch adds a chapter about the scheduling policies it supports. Peter Zijlstra provided most of the information for it in

http://marc.info/?l=linux-kernel&m=122210038326356&w=2

This patch is based on 2.6.27-rc7.

---

sched-design-CFS.txt 2008-09-23 10:33:01.107393509 +0200 renamed from sched-design-CFS.txt-2.6.27-rc7 2008-07-13 23:51:29.000000000 +0200 +23 -0
@@ -118,6 +118,29 @@ Some implementation details:
    quite a bit simpler as a result.
 
 
+Supported scheduling policies
+=============================
+
+CFS implements three scheduling policies:
+
+  - SCHED_NORMAL (traditionally called SCHED_OTHER): The scheduling
+    policy that is used for regular tasks.
+
+  - SCHED_BATCH: Does not preempt nearly as often as regular tasks
+    would, thereby allowing tasks to run longer and make better use of
+    caches but at the cost of interactivity. This is well suited for
+    batch jobs.
+
+  - SCHED_IDLE: This is even weaker than nice 19, but its not a true
+    idle timer scheduler in order to avoid to get into priority
+    inversion problems which would deadlock the machine.
+
+SCHED_FIFO/_RR are implemented in sched_rt.c and are as specified by
+POSIX.
+
+The command chrt from util-linux-ng 2.13.1.1 can set all of these except
+SCHED_IDLE.
+
 Group scheduler extension to CFS
 ================================
 
Signature · 2 lines
Martin Steigerwald - team(ix) GmbH - http://www.teamix.de
gpg: 19E3 8D42 896F D004 08AC A0CA 1E10 C593 0399 AE90
#1 lore raw
Quoted 9 lines · Martin Steigerwald

The documentation about the CFS scheduler is scarse when it comes to scheduling policies. This patch adds a chapter about the scheduling policies it supports. Peter Zijlstra provided most of the information for it in

http://marc.info/?l=linux-kernel&m=122210038326356&w=2

This patch is based on 2.6.27-rc7.

looks good to me - but could you please do the patch against the latest scheduler tree, which has already updated this file (and which made your patch not apply cleanly):

http://people.redhat.com/mingo/tip.git/README

also:

sched-design-CFS.txt 2008-09-23 10:33:01.107393509 +0200

Quoted 2 lines
sched-design-CFS.txt 2008-09-23 10:33:01.107393509 +0200 renamed from sched-design-CFS.txt-2.6.27-rc7 2008-07-13 23:51:29.000000000 +0200 +0 -0

please use -p1 to create patches - or since you've just set up the tip/master tracking, do something like:

<modify Documentation/scheduler/sched-design-CFS.txt>

git-commit Documentation/scheduler/sched-design-CFS.txt

<add commit log>

and then export the commit you just created for use in emailing, via:

  git log --pretty=email --stat -1 -p > mail.txt

Ingo

#2 lore raw

Am Dienstag, 23. September 2008 schrieb Ingo Molnar:

Quoted 10 lines · Martin Steigerwald
Quoted 9 lines

The documentation about the CFS scheduler is scarse when it comes to scheduling policies. This patch adds a chapter about the scheduling policies it supports. Peter Zijlstra provided most of the information for it in

http://marc.info/?l=linux-kernel&m=122210038326356&w=2

This patch is based on 2.6.27-rc7.

Quoted 7 lines
Quoted 1 line

looks good to me - but could you please do the patch against the latest scheduler tree, which has already updated this file (and which made your patch not apply cleanly):

http://people.redhat.com/mingo/tip.git/README

Should I use

checkout -b tip-latest tip/master

as described in the README or tip/sched/devel or even something else?

I am new to git. I know Bazaar quite well however, so I am not compeltely new to DVCS.

Ciao,

Signature · 2 lines
Martin Steigerwald - team(ix) GmbH - http://www.teamix.de
gpg: 19E3 8D42 896F D004 08AC A0CA 1E10 C593 0399 AE90
#3 lore raw
Quoted 17 lines · Martin Steigerwald

Am Dienstag, 23. September 2008 schrieb Ingo Molnar:

Quoted 16 lines · Martin Steigerwald
Quoted 10 lines

The documentation about the CFS scheduler is scarse when it comes to scheduling policies. This patch adds a chapter about the scheduling policies it supports. Peter Zijlstra provided most of the information for it in

http://marc.info/?l=linux-kernel&m=122210038326356&w=2

This patch is based on 2.6.27-rc7.

looks good to me - but could you please do the patch against the latest scheduler tree, which has already updated this file (and which made your patch not apply cleanly):

Quoted 7 lines
Quoted 1 line

http://people.redhat.com/mingo/tip.git/README

Should I use

checkout -b tip-latest tip/master

as described in the README or tip/sched/devel or even something else?

tip/master should be fine - it has sched/devel integrated. I'll sort out any cross-topic impact.

Quoted 2 lines

I am new to git. I know Bazaar quite well however, so I am not compeltely new to DVCS.

the -tip tree, maintained by Thomas Gleixner, H. Peter Anvin and myself is a "forest of trees" based on Linus's very latest -git tree. Currently it's a collection of more than 180 topic trees. Most topic trees are based on upstream -git, some topic trees are based on each other and tip/master has them all integrated together.

there are a few main themes within -tip: tip/x86/* are all the currently active x86 topics - all changes that are for v2.6.28. tip/sched/* are the pending scheduler changes. tip/timers/* are timer changes, tip/tracing/* are tracing patches, etc.

Unless you are a high-volume patch submitter or a maintainer of a given topic tree it's not necessary for you to know/follow/interpret the internal structure of -tip - you can send patches against tip/master and we'll sort the patch out into the right topic branch. (and resolve conflicts, if any)

Generally tip/master is not supposed to break in any way anytime: it must build and boot on all hardware, no ifs and when. So it's not a development tree in the classic sense, i.e. temporary breakages and user-visible transition periods are not accepted. We do a lot of automated testing against tip/master so it should be fine for daily desktop use and daily development work. I use latest tip/master on about 7 x86 boxes at the moment.

The individual topic trees are development trees, and might contain bugs at times - but we filter those out and only represent/merge a known-stable version of each sub-tree in tip/master.

At least that's the theory - it's still a high-flux tree with multiple updates every day and has an average of ~15 new commits added per day, 24/7. If you see a problem with it then please report it.

Ingo

#4 lore raw
In reply to Ingo Molnar

Am Dienstag, 23. September 2008 schrieb Ingo Molnar:

Quoted 16 lines · Martin Steigerwald
Quoted 10 lines

The documentation about the CFS scheduler is scarse when it comes to scheduling policies. This patch adds a chapter about the scheduling policies it supports. Peter Zijlstra provided most of the information for it in

http://marc.info/?l=linux-kernel&m=122210038326356&w=2

This patch is based on 2.6.27-rc7.

looks good to me - but could you please do the patch against the latest scheduler tree, which has already updated this file (and which made your patch not apply cleanly):

Quoted 8 lines

  http://people.redhat.com/mingo/tip.git/README

also:

Quoted 2 lines

--- sched-design-CFS.txt-2.6.27-rc7     2008-07-13 23:51:29.000000000 +0200 +++ sched-design-CFS.txt        2008-09-23 10:33:01.107393509 +0200

please use -p1 to create patches - or since you've just set up the tip/master tracking, do something like:

Okay, lets see how this works out.

---
From a57581d4ec3b13f63920b89c336ac9c93c6cf9f0 Mon Sep 17 00:00:00 2001
From: Martin Steigerwald <[email protected]>
Date: Tue, 23 Sep 2008 13:45:46 +0200
Subject: [PATCH] CFS: Documentation about scheduling policies

The documentation about the CFS scheduler is scarse when it comes to scheduling policies. This patch adds a chapter about the scheduling policies it supports. Peter Zijlstra provided most of the information for it in

http://marc.info/?l=linux-kernel&m=122210038326356&w=2

---
 Documentation/scheduler/sched-design-CFS.txt |   28 ++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 2 deletions(-)
Documentation/scheduler/sched-design-CFS.txt +26 -2
index b2aa856..9d8eb55 100644
@@ -114,7 +114,31 @@ result.
 
 
 
-5.  SCHEDULING CLASSES
+5. Scheduling policies
+
+CFS implements three scheduling policies:
+
+  - SCHED_NORMAL (traditionally called SCHED_OTHER): The scheduling
+    policy that is used for regular tasks.
+
+  - SCHED_BATCH: Does not preempt nearly as often as regular tasks
+    would, thereby allowing tasks to run longer and make better use of
+    caches but at the cost of interactivity. This is well suited for
+    batch jobs.
+
+  - SCHED_IDLE: This is even weaker than nice 19, but its not a true
+    idle timer scheduler in order to avoid to get into priority
+    inversion problems which would deadlock the machine.
+
+SCHED_FIFO/_RR are implemented in sched_rt.c and are as specified by
+POSIX.
+
+The command chrt from util-linux-ng 2.13.1.1 can set all of these except
+SCHED_IDLE.
+
+
+
+6.  SCHEDULING CLASSES
 
 The new CFS scheduler has been designed in such a way to introduce "Scheduling
 Classes," an extensible hierarchy of scheduler modules.  These modules
@@ -179,7 +203,7 @@ This is the (partial) list of the hooks:
 
 
 
-6.  GROUP SCHEDULER EXTENSIONS TO CFS
+7.  GROUP SCHEDULER EXTENSIONS TO CFS
 
 Normally, the scheduler operates on individual tasks and strives to provide
 fair CPU time to each task.  Sometimes, it may be desirable to group tasks and
Signature · 2 lines
Martin Steigerwald - team(ix) GmbH - http://www.teamix.de
gpg: 19E3 8D42 896F D004 08AC A0CA 1E10 C593 0399 AE90
Applied
#5 lore raw
Quoted 10 lines · Martin Steigerwald
Quoted 2 lines

please use -p1 to create patches - or since you've just set up the tip/master tracking, do something like:

Okay, lets see how this works out.

---
From a57581d4ec3b13f63920b89c336ac9c93c6cf9f0 Mon Sep 17 00:00:00 2001
From: Martin Steigerwald <[email protected]>
Date: Tue, 23 Sep 2008 13:45:46 +0200
Subject: [PATCH] CFS: Documentation about scheduling policies

Applied to tip/sched/devel, merged it into tip/master and pushed the result out - thanks Martin.

this was a perfect patch :)

Ingo

#6 lore raw

Am Dienstag, 23. September 2008 schrieb Ingo Molnar:

Quoted 12 lines · Martin Steigerwald
Quoted 10 lines
Quoted 2 lines

please use -p1 to create patches - or since you've just set up the tip/master tracking, do something like:

Okay, lets see how this works out.

---
From a57581d4ec3b13f63920b89c336ac9c93c6cf9f0 Mon Sep 17 00:00:00 2001
From: Martin Steigerwald <[email protected]>
Date: Tue, 23 Sep 2008 13:45:46 +0200
Subject: [PATCH] CFS: Documentation about scheduling policies

Quoted 4 lines

Applied to tip/sched/devel, merged it into tip/master and pushed the result out - thanks Martin.

this was a perfect patch :)

Thanks. Now I can learn how I can update my local tip-master ;-). Hmmm, git pull seemed to do the trick although it did not touch Documentation/scheduler/sched-design-CFS.txt again. Seems it detected that I applied the patch I sent you already.

Will it be in 2.6.28 or even in 2.6.27? 8-)

Looking forward to further documentation patches - these can't break any code ;-).

Signature · 2 lines
Martin Steigerwald - team(ix) GmbH - http://www.teamix.de
gpg: 19E3 8D42 896F D004 08AC A0CA 1E10 C593 0399 AE90
#7 lore raw
Quoted 16 lines · Martin Steigerwald

Am Dienstag, 23. September 2008 schrieb Ingo Molnar:

Quoted 15 lines · Martin Steigerwald
Quoted 10 lines
Quoted 2 lines

please use -p1 to create patches - or since you've just set up the tip/master tracking, do something like:

Okay, lets see how this works out.

---
From a57581d4ec3b13f63920b89c336ac9c93c6cf9f0 Mon Sep 17 00:00:00 2001
From: Martin Steigerwald <[email protected]>
Date: Tue, 23 Sep 2008 13:45:46 +0200
Subject: [PATCH] CFS: Documentation about scheduling policies

Applied to tip/sched/devel, merged it into tip/master and pushed the result out - thanks Martin.

Quoted 6 lines
Quoted 1 line

this was a perfect patch :)

Thanks. Now I can learn how I can update my local tip-master ;-). Hmmm, git pull seemed to do the trick although it did not touch Documentation/scheduler/sched-design-CFS.txt again. Seems it detected that I applied the patch I sent you already.

yes.

the best way to update is to have tip as a remote and to update via 'git remote update'. Then you can do "git merge tip/master" - or if this does not work (tip/master is an integration branch and has to be reset occasionally) then you can do a 'git-reset --hard tip/master' to switch over to the new tree.

NOTE: a hard reset means you'll lose local commits. If you want to carry them over then do something like:

git rebase -i --onto tip/master 123412341234

where 123412341234 is the sha1 of the previous tip/master you based your local changes on.

Quoted 1 line

Will it be in 2.6.28 or even in 2.6.27? 8-)

yes, it's queued up for v2.6.28. For v2.6.27 we [in -tip] dont do documentation updates starting at around -rc4 or so (to reduce the upstream churn).

Quoted 2 lines

Looking forward to further documentation patches - these can't break any code ;-).

definitely ;-)

Ingo

#8 lore raw
In reply to Martin Steigerwald
Quoted 16 lines · Martin Steigerwald

Am Dienstag, 23. September 2008 schrieb Ingo Molnar:

Quoted 15 lines · Martin Steigerwald
Quoted 10 lines
Quoted 2 lines

please use -p1 to create patches - or since you've just set up the tip/master tracking, do something like:

Okay, lets see how this works out.

---
From a57581d4ec3b13f63920b89c336ac9c93c6cf9f0 Mon Sep 17 00:00:00 2001
From: Martin Steigerwald <[email protected]>
Date: Tue, 23 Sep 2008 13:45:46 +0200
Subject: [PATCH] CFS: Documentation about scheduling policies

Applied to tip/sched/devel, merged it into tip/master and pushed the result out - thanks Martin.

Quoted 6 lines
Quoted 1 line

this was a perfect patch :)

Thanks. Now I can learn how I can update my local tip-master ;-). Hmmm, git pull seemed to do the trick although it did not touch Documentation/scheduler/sched-design-CFS.txt again. Seems it detected that I applied the patch I sent you already.

'git remote update' will be best, 'git pull' only works if the underlying stuff never gets rebased.