diff options
Diffstat (limited to 'Documentation/sched-stats.txt')
| -rw-r--r-- | Documentation/sched-stats.txt | 195 |
1 files changed, 99 insertions, 96 deletions
diff --git a/Documentation/sched-stats.txt b/Documentation/sched-stats.txt index 6f72021aae51..442e14d35dea 100644 --- a/Documentation/sched-stats.txt +++ b/Documentation/sched-stats.txt | |||
| @@ -1,10 +1,11 @@ | |||
| 1 | Version 10 of schedstats includes support for sched_domains, which | 1 | Version 14 of schedstats includes support for sched_domains, which hit the |
| 2 | hit the mainline kernel in 2.6.7. Some counters make more sense to be | 2 | mainline kernel in 2.6.20 although it is identical to the stats from version |
| 3 | per-runqueue; other to be per-domain. Note that domains (and their associated | 3 | 12 which was in the kernel from 2.6.13-2.6.19 (version 13 never saw a kernel |
| 4 | information) will only be pertinent and available on machines utilizing | 4 | release). Some counters make more sense to be per-runqueue; other to be |
| 5 | CONFIG_SMP. | 5 | per-domain. Note that domains (and their associated information) will only |
| 6 | 6 | be pertinent and available on machines utilizing CONFIG_SMP. | |
| 7 | In version 10 of schedstat, there is at least one level of domain | 7 | |
| 8 | In version 14 of schedstat, there is at least one level of domain | ||
| 8 | statistics for each cpu listed, and there may well be more than one | 9 | statistics for each cpu listed, and there may well be more than one |
| 9 | domain. Domains have no particular names in this implementation, but | 10 | domain. Domains have no particular names in this implementation, but |
| 10 | the highest numbered one typically arbitrates balancing across all the | 11 | the highest numbered one typically arbitrates balancing across all the |
| @@ -27,7 +28,7 @@ to write their own scripts, the fields are described here. | |||
| 27 | 28 | ||
| 28 | CPU statistics | 29 | CPU statistics |
| 29 | -------------- | 30 | -------------- |
| 30 | cpu<N> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 31 | cpu<N> 1 2 3 4 5 6 7 8 9 10 11 12 |
| 31 | 32 | ||
| 32 | NOTE: In the sched_yield() statistics, the active queue is considered empty | 33 | NOTE: In the sched_yield() statistics, the active queue is considered empty |
| 33 | if it has only one process in it, since obviously the process calling | 34 | if it has only one process in it, since obviously the process calling |
| @@ -39,48 +40,20 @@ First four fields are sched_yield() statistics: | |||
| 39 | 3) # of times just the expired queue was empty | 40 | 3) # of times just the expired queue was empty |
| 40 | 4) # of times sched_yield() was called | 41 | 4) # of times sched_yield() was called |
| 41 | 42 | ||
| 42 | Next four are schedule() statistics: | 43 | Next three are schedule() statistics: |
| 43 | 5) # of times the active queue had at least one other process on it | 44 | 5) # of times we switched to the expired queue and reused it |
| 44 | 6) # of times we switched to the expired queue and reused it | 45 | 6) # of times schedule() was called |
| 45 | 7) # of times schedule() was called | 46 | 7) # of times schedule() left the processor idle |
| 46 | 8) # of times schedule() left the processor idle | ||
| 47 | |||
| 48 | Next four are active_load_balance() statistics: | ||
| 49 | 9) # of times active_load_balance() was called | ||
| 50 | 10) # of times active_load_balance() caused this cpu to gain a task | ||
| 51 | 11) # of times active_load_balance() caused this cpu to lose a task | ||
| 52 | 12) # of times active_load_balance() tried to move a task and failed | ||
| 53 | |||
| 54 | Next three are try_to_wake_up() statistics: | ||
| 55 | 13) # of times try_to_wake_up() was called | ||
| 56 | 14) # of times try_to_wake_up() successfully moved the awakening task | ||
| 57 | 15) # of times try_to_wake_up() attempted to move the awakening task | ||
| 58 | |||
| 59 | Next two are wake_up_new_task() statistics: | ||
| 60 | 16) # of times wake_up_new_task() was called | ||
| 61 | 17) # of times wake_up_new_task() successfully moved the new task | ||
| 62 | |||
| 63 | Next one is a sched_migrate_task() statistic: | ||
| 64 | 18) # of times sched_migrate_task() was called | ||
| 65 | 47 | ||
| 66 | Next one is a sched_balance_exec() statistic: | 48 | Next two are try_to_wake_up() statistics: |
| 67 | 19) # of times sched_balance_exec() was called | 49 | 8) # of times try_to_wake_up() was called |
| 50 | 9) # of times try_to_wake_up() was called to wake up the local cpu | ||
| 68 | 51 | ||
| 69 | Next three are statistics describing scheduling latency: | 52 | Next three are statistics describing scheduling latency: |
| 70 | 20) sum of all time spent running by tasks on this processor (in ms) | 53 | 10) sum of all time spent running by tasks on this processor (in jiffies) |
| 71 | 21) sum of all time spent waiting to run by tasks on this processor (in ms) | 54 | 11) sum of all time spent waiting to run by tasks on this processor (in |
| 72 | 22) # of tasks (not necessarily unique) given to the processor | 55 | jiffies) |
| 73 | 56 | 12) # of timeslices run on this cpu | |
| 74 | The last six are statistics dealing with pull_task(): | ||
| 75 | 23) # of times pull_task() moved a task to this cpu when newly idle | ||
| 76 | 24) # of times pull_task() stole a task from this cpu when another cpu | ||
| 77 | was newly idle | ||
| 78 | 25) # of times pull_task() moved a task to this cpu when idle | ||
| 79 | 26) # of times pull_task() stole a task from this cpu when another cpu | ||
| 80 | was idle | ||
| 81 | 27) # of times pull_task() moved a task to this cpu when busy | ||
| 82 | 28) # of times pull_task() stole a task from this cpu when another cpu | ||
| 83 | was busy | ||
| 84 | 57 | ||
| 85 | 58 | ||
| 86 | Domain statistics | 59 | Domain statistics |
| @@ -89,65 +62,95 @@ One of these is produced per domain for each cpu described. (Note that if | |||
| 89 | CONFIG_SMP is not defined, *no* domains are utilized and these lines | 62 | CONFIG_SMP is not defined, *no* domains are utilized and these lines |
| 90 | will not appear in the output.) | 63 | will not appear in the output.) |
| 91 | 64 | ||
| 92 | domain<N> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 65 | domain<N> <cpumask> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
| 93 | 66 | ||
| 94 | The first field is a bit mask indicating what cpus this domain operates over. | 67 | The first field is a bit mask indicating what cpus this domain operates over. |
| 95 | 68 | ||
| 96 | The next fifteen are a variety of load_balance() statistics: | 69 | The next 24 are a variety of load_balance() statistics in grouped into types |
| 97 | 70 | of idleness (idle, busy, and newly idle): | |
| 98 | 1) # of times in this domain load_balance() was called when the cpu | 71 | |
| 99 | was idle | 72 | 1) # of times in this domain load_balance() was called when the |
| 100 | 2) # of times in this domain load_balance() was called when the cpu | 73 | cpu was idle |
| 101 | was busy | 74 | 2) # of times in this domain load_balance() checked but found |
| 102 | 3) # of times in this domain load_balance() was called when the cpu | 75 | the load did not require balancing when the cpu was idle |
| 103 | was just becoming idle | 76 | 3) # of times in this domain load_balance() tried to move one or |
| 104 | 4) # of times in this domain load_balance() tried to move one or more | 77 | more tasks and failed, when the cpu was idle |
| 105 | tasks and failed, when the cpu was idle | 78 | 4) sum of imbalances discovered (if any) with each call to |
| 106 | 5) # of times in this domain load_balance() tried to move one or more | 79 | load_balance() in this domain when the cpu was idle |
| 107 | tasks and failed, when the cpu was busy | 80 | 5) # of times in this domain pull_task() was called when the cpu |
| 108 | 6) # of times in this domain load_balance() tried to move one or more | 81 | was idle |
| 109 | tasks and failed, when the cpu was just becoming idle | 82 | 6) # of times in this domain pull_task() was called even though |
| 110 | 7) sum of imbalances discovered (if any) with each call to | 83 | the target task was cache-hot when idle |
| 111 | load_balance() in this domain when the cpu was idle | 84 | 7) # of times in this domain load_balance() was called but did |
| 112 | 8) sum of imbalances discovered (if any) with each call to | 85 | not find a busier queue while the cpu was idle |
| 113 | load_balance() in this domain when the cpu was busy | 86 | 8) # of times in this domain a busier queue was found while the |
| 114 | 9) sum of imbalances discovered (if any) with each call to | 87 | cpu was idle but no busier group was found |
| 115 | load_balance() in this domain when the cpu was just becoming idle | 88 | |
| 116 | 10) # of times in this domain load_balance() was called but did not find | 89 | 9) # of times in this domain load_balance() was called when the |
| 117 | a busier queue while the cpu was idle | 90 | cpu was busy |
| 118 | 11) # of times in this domain load_balance() was called but did not find | 91 | 10) # of times in this domain load_balance() checked but found the |
| 119 | a busier queue while the cpu was busy | 92 | load did not require balancing when busy |
| 120 | 12) # of times in this domain load_balance() was called but did not find | 93 | 11) # of times in this domain load_balance() tried to move one or |
| 121 | a busier queue while the cpu was just becoming idle | 94 | more tasks and failed, when the cpu was busy |
| 122 | 13) # of times in this domain a busier queue was found while the cpu was | 95 | 12) sum of imbalances discovered (if any) with each call to |
| 123 | idle but no busier group was found | 96 | load_balance() in this domain when the cpu was busy |
| 124 | 14) # of times in this domain a busier queue was found while the cpu was | 97 | 13) # of times in this domain pull_task() was called when busy |
| 125 | busy but no busier group was found | 98 | 14) # of times in this domain pull_task() was called even though the |
| 126 | 15) # of times in this domain a busier queue was found while the cpu was | 99 | target task was cache-hot when busy |
| 127 | just becoming idle but no busier group was found | 100 | 15) # of times in this domain load_balance() was called but did not |
| 128 | 101 | find a busier queue while the cpu was busy | |
| 129 | Next two are sched_balance_exec() statistics: | 102 | 16) # of times in this domain a busier queue was found while the cpu |
| 130 | 17) # of times in this domain sched_balance_exec() successfully pushed | 103 | was busy but no busier group was found |
| 131 | a task to a new cpu | 104 | |
| 132 | 18) # of times in this domain sched_balance_exec() tried but failed to | 105 | 17) # of times in this domain load_balance() was called when the |
| 133 | push a task to a new cpu | 106 | cpu was just becoming idle |
| 134 | 107 | 18) # of times in this domain load_balance() checked but found the | |
| 135 | Next two are try_to_wake_up() statistics: | 108 | load did not require balancing when the cpu was just becoming idle |
| 136 | 19) # of times in this domain try_to_wake_up() tried to move a task based | 109 | 19) # of times in this domain load_balance() tried to move one or more |
| 137 | on affinity and cache warmth | 110 | tasks and failed, when the cpu was just becoming idle |
| 138 | 20) # of times in this domain try_to_wake_up() tried to move a task based | 111 | 20) sum of imbalances discovered (if any) with each call to |
| 139 | on load balancing | 112 | load_balance() in this domain when the cpu was just becoming idle |
| 140 | 113 | 21) # of times in this domain pull_task() was called when newly idle | |
| 114 | 22) # of times in this domain pull_task() was called even though the | ||
| 115 | target task was cache-hot when just becoming idle | ||
| 116 | 23) # of times in this domain load_balance() was called but did not | ||
| 117 | find a busier queue while the cpu was just becoming idle | ||
| 118 | 24) # of times in this domain a busier queue was found while the cpu | ||
| 119 | was just becoming idle but no busier group was found | ||
| 120 | |||
| 121 | Next three are active_load_balance() statistics: | ||
| 122 | 25) # of times active_load_balance() was called | ||
| 123 | 26) # of times active_load_balance() tried to move a task and failed | ||
| 124 | 27) # of times active_load_balance() successfully moved a task | ||
| 125 | |||
| 126 | Next three are sched_balance_exec() statistics: | ||
| 127 | 28) sbe_cnt is not used | ||
| 128 | 29) sbe_balanced is not used | ||
| 129 | 30) sbe_pushed is not used | ||
| 130 | |||
| 131 | Next three are sched_balance_fork() statistics: | ||
| 132 | 31) sbf_cnt is not used | ||
| 133 | 32) sbf_balanced is not used | ||
| 134 | 33) sbf_pushed is not used | ||
| 135 | |||
| 136 | Next three are try_to_wake_up() statistics: | ||
| 137 | 34) # of times in this domain try_to_wake_up() awoke a task that | ||
| 138 | last ran on a different cpu in this domain | ||
| 139 | 35) # of times in this domain try_to_wake_up() moved a task to the | ||
| 140 | waking cpu because it was cache-cold on its own cpu anyway | ||
| 141 | 36) # of times in this domain try_to_wake_up() started passive balancing | ||
| 141 | 142 | ||
| 142 | /proc/<pid>/schedstat | 143 | /proc/<pid>/schedstat |
| 143 | ---------------- | 144 | ---------------- |
| 144 | schedstats also adds a new /proc/<pid/schedstat file to include some of | 145 | schedstats also adds a new /proc/<pid/schedstat file to include some of |
| 145 | the same information on a per-process level. There are three fields in | 146 | the same information on a per-process level. There are three fields in |
| 146 | this file correlating to fields 20, 21, and 22 in the CPU fields, but | 147 | this file correlating for that process to: |
| 147 | they only apply for that process. | 148 | 1) time spent on the cpu |
| 149 | 2) time spent waiting on a runqueue | ||
| 150 | 3) # of timeslices run on this cpu | ||
| 148 | 151 | ||
| 149 | A program could be easily written to make use of these extra fields to | 152 | A program could be easily written to make use of these extra fields to |
| 150 | report on how well a particular process or set of processes is faring | 153 | report on how well a particular process or set of processes is faring |
| 151 | under the scheduler's policies. A simple version of such a program is | 154 | under the scheduler's policies. A simple version of such a program is |
| 152 | available at | 155 | available at |
| 153 | http://eaglet.rain.com/rick/linux/schedstat/v10/latency.c | 156 | http://eaglet.rain.com/rick/linux/schedstat/v12/latency.c |
