ckrm E17 memory controller
[linux-2.6.git] / Documentation / ckrm / mem_rc.usage
1 Installation
2 ------------
3
4 1. Configure "Class based physical memory controller" under CKRM (see
5       Documentation/ckrm/installation) 
6
7 2. Reboot the system with the new kernel.
8
9 3. Verify that the memory controller is present by reading the file
10    /rcfs/taskclass/config (should show a line with res=mem)
11
12 Usage
13 -----
14
15 For brevity, unless otherwise specified all the following commands are
16 executed in the default class (/rcfs/taskclass).
17
18 Initially, the systemwide default class gets 100% of the LRU pages, and the
19 stats file at the /rcfs/taskclass level displays the total number of
20 physical pages.
21
22    # cd /rcfs/taskclass
23    # grep System stats
24    System: tot_pages=239778,active=60473,inactive=135285,free=44555
25    # cat shares
26    res=mem,guarantee=-2,limit=-2,total_guarantee=100,max_limit=100
27
28    tot_pages - total number of pages
29    active    - number of pages in the active list ( sum of all zones)
30    inactive  - number of pages in the inactive list ( sum of all zones)
31    free      - number of free pages (sum of all zones)
32
33    By making total_guarantee and max_limit to be same as tot_pages, one can 
34    make the numbers in shares file be same as the number of pages for a
35    class.
36
37    # echo 'res=mem,total_guarantee=239778,max_limit=239778' > shares
38    # cat shares
39    res=mem,guarantee=-2,limit=-2,total_guarantee=239778,max_limit=239778
40
41 Changing configuration parameters:
42 ----------------------------------
43 For description of the paramters read the file mem_rc.design in this same directory.
44
45 Following is the default values for the configuration parameters:
46
47    localhost:~ # cd /rcfs/taskclass
48    localhost:/rcfs/taskclass # cat config
49    res=mem,fail_over=110,shrink_at=90,shrink_to=80,num_shrinks=10,shrink_interval=10
50
51 Here is how to change a specific configuration parameter. Note that more than one 
52 configuration parameter can be changed in a single echo command though for simplicity
53 we show one per echo.
54
55 ex: Changing fail_over: 
56    localhost:/rcfs/taskclass # echo "res=mem,fail_over=120" > config
57    localhost:/rcfs/taskclass # cat config
58    res=mem,fail_over=120,shrink_at=90,shrink_to=80,num_shrinks=10,shrink_interval=10
59
60 ex: Changing shrink_at: 
61    localhost:/rcfs/taskclass # echo "res=mem,shrink_at=85" > config
62    localhost:/rcfs/taskclass # cat config
63    res=mem,fail_over=120,shrink_at=85,shrink_to=80,num_shrinks=10,shrink_interval=10
64
65 ex: Changing shrink_to: 
66    localhost:/rcfs/taskclass # echo "res=mem,shrink_to=75" > config
67    localhost:/rcfs/taskclass # cat config
68    res=mem,fail_over=120,shrink_at=85,shrink_to=75,num_shrinks=10,shrink_interval=10
69
70 ex: Changing num_shrinks: 
71    localhost:/rcfs/taskclass # echo "res=mem,num_shrinks=20" > config
72    localhost:/rcfs/taskclass # cat config
73    res=mem,fail_over=120,shrink_at=85,shrink_to=75,num_shrinks=20,shrink_interval=10
74
75 ex: Changing shrink_interval: 
76    localhost:/rcfs/taskclass # echo "res=mem,shrink_interval=15" > config
77    localhost:/rcfs/taskclass # cat config
78    res=mem,fail_over=120,shrink_at=85,shrink_to=75,num_shrinks=20,shrink_interval=15
79
80 Class creation 
81 --------------
82
83    # mkdir c1
84
85 Its initial share is DONT_CARE. The parent's share values will be unchanged.
86
87 Setting a new class share
88 -------------------------
89         
90    # echo 'res=mem,guarantee=25000,limit=50000' > c1/shares
91
92    # cat c1/shares      
93    res=mem,guarantee=25000,limit=50000,total_guarantee=100,max_limit=100
94         
95    'guarantee' specifies the number of pages this class entitled to get
96    'limit' is the maximum number of pages this class can get.
97
98 Monitoring
99 ----------
100
101 stats file shows statistics of the page usage of a class
102    # cat stats
103    ----------- Memory Resource stats start -----------
104    System: tot_pages=239778,active=60473,inactive=135285,free=44555
105    Number of pages used(including pages lent to children): 196654
106    Number of pages guaranteed: 239778
107    Maximum limit of pages: 239778
108    Total number of pages available(after serving guarantees to children): 214778
109    Number of pages lent to children: 0
110    Number of pages borrowed from the parent: 0
111    ----------- Memory Resource stats end -----------
112