This commit was manufactured by cvs2svn to create branch
[linux-2.6.git] / Documentation / ckrm / cpusched
1 CKRM CPU Scheduling 
2 ===================
3
4 Overview
5 --------
6
7 In CKRM, cpu scheduling is based on a two level scheduling decision.
8 Every time a new task is to be selected, the scheduler first determines
9 which class to run next and then schedules the next task in selected
10 task.
11
12 The scheduling within a class is performed using the default Linux
13 O(1) scheduler.
14
15 The class scheduler also follows the O(1) principle and works as
16 follows: 
17
18 Each class maintains a local runqueue per cpu aka <struct
19 ckrm_runqueue> or short lrq. The existing O(1) scheduler is used to
20 schedule within an <lrq>.
21
22 Weights are assigned to each lrq that mirror the effectives shares of
23 that class. Every time a task executes, its weighted cycles are
24 charged against its class. Thus classes progress in time called
25 cummulative virtual time (CVT). In essence the class with the smallest
26 CVT is selected next. Provisions are made to keep interactivity and
27 avoid starvation by longer sleeping classes.
28
29 Load balancing across an SMP is performed by balancing the load of
30 each class across CPUs such that they produce equal load and thus 
31 on the whole system maintain their share.
32
33 Due to the fact that CKRM uses a class hierarchy, cycles that are unused
34 by a class are redistributed to among busy siblings.
35 Enabling the CKRM CPU scheduler
36 -------------------------------
37
38 The scheduler is integrated into the linux scheduler and therefore
39 can not be loaded dynamically like other CKRM schedulers
40
41 However it can be selected at boot time or dynamically at run time.
42
43 The boot options "ckrmcpu" OR "nockrmcpu" enable / disable the CKRM
44 cpu scheduler at boot time. Currently by default the scheduler is
45 disabled.
46
47 # cat /rcfs/taskclass/config 
48
49 "res=cpu,mode=enabled" indicates that the CKRM cpu scheduler is
50 enabled
51
52 "res=cpu,mode=disabled" indicates that the CKRM cpu scheduler is
53 disabled
54
55 The strings can also be used to dynamically change the scheduling modus
56 at runtime. For example, to dynamically activate the scheduler.
57
58 # echo "res=cpu,mode=enabled" > /rcfs/taskclass/config
59
60 # cat /rcfs/taskclass/*/stats
61
62 The cpu portion of the scheduler is shown
63
64     "cpu-usage(2,10,60)= 290 340 510"
65
66 The 3 numbers represent the load for the 2 second, 10 second 
67 and 60 seconds. The base = 1000.
68 Hence the system has 29.0%, 33.5% and 49.8% respectively
69
70 For debugging purposes additional information can be printed out but
71 that format should not be relied upon. 
72
73 Use `echo "res=cpu,usage_detail=3" for the highest detail on usage.
74 Please consult the source code for the specifics.
75
76 Assigning shares
77 ----------------
78
79 Follows the general approach described under ckrm_basics.
80
81 # echo "res=cpu,guarantee=val" > shares   
82
83 sets the minimum guarantee of a class.
84
85
86