diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
| commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
| tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /kernel | |
| parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) | |
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/pm_qos_params.c | 526 | ||||
| -rw-r--r-- | kernel/power/consoleearlysuspend.c | 78 | ||||
| -rw-r--r-- | kernel/power/earlysuspend.c | 187 | ||||
| -rw-r--r-- | kernel/power/fbearlysuspend.c | 153 | ||||
| -rw-r--r-- | kernel/power/suspend_time.c | 111 | ||||
| -rw-r--r-- | kernel/power/userwakelock.c | 219 | ||||
| -rw-r--r-- | kernel/sched.c | 9443 | ||||
| -rw-r--r-- | kernel/sched_autogroup.c | 275 | ||||
| -rw-r--r-- | kernel/sched_autogroup.h | 42 | ||||
| -rw-r--r-- | kernel/sched_clock.c | 350 | ||||
| -rw-r--r-- | kernel/sched_cpupri.c | 204 | ||||
| -rw-r--r-- | kernel/sched_cpupri.h | 37 | ||||
| -rw-r--r-- | kernel/sched_debug.c | 508 | ||||
| -rw-r--r-- | kernel/sched_fair.c | 4346 | ||||
| -rw-r--r-- | kernel/sched_features.h | 74 | ||||
| -rw-r--r-- | kernel/sched_idletask.c | 97 | ||||
| -rw-r--r-- | kernel/sched_rt.c | 1866 | ||||
| -rw-r--r-- | kernel/sched_stats.h | 336 | ||||
| -rw-r--r-- | kernel/sched_stoptask.c | 104 | ||||
| -rw-r--r-- | kernel/sysctl_check.c | 160 | ||||
| -rw-r--r-- | kernel/time/timecompare.c | 193 | ||||
| -rw-r--r-- | kernel/trace/trace_workqueue.c | 300 | ||||
| -rw-r--r-- | kernel/trace/tracedump.c | 682 | ||||
| -rw-r--r-- | kernel/trace/tracelevel.c | 142 |
24 files changed, 20433 insertions, 0 deletions
diff --git a/kernel/pm_qos_params.c b/kernel/pm_qos_params.c new file mode 100644 index 00000000000..82da7ac3b1f --- /dev/null +++ b/kernel/pm_qos_params.c | |||
| @@ -0,0 +1,526 @@ | |||
| 1 | /* | ||
| 2 | * This module exposes the interface to kernel space for specifying | ||
| 3 | * QoS dependencies. It provides infrastructure for registration of: | ||
| 4 | * | ||
| 5 | * Dependents on a QoS value : register requests | ||
| 6 | * Watchers of QoS value : get notified when target QoS value changes | ||
| 7 | * | ||
| 8 | * This QoS design is best effort based. Dependents register their QoS needs. | ||
| 9 | * Watchers register to keep track of the current QoS needs of the system. | ||
| 10 | * | ||
| 11 | * There are 3 basic classes of QoS parameter: latency, timeout, throughput | ||
| 12 | * each have defined units: | ||
| 13 | * latency: usec | ||
| 14 | * timeout: usec <-- currently not used. | ||
| 15 | * throughput: kbs (kilo byte / sec) | ||
| 16 | * | ||
| 17 | * There are lists of pm_qos_objects each one wrapping requests, notifiers | ||
| 18 | * | ||
| 19 | * User mode requests on a QOS parameter register themselves to the | ||
| 20 | * subsystem by opening the device node /dev/... and writing there request to | ||
| 21 | * the node. As long as the process holds a file handle open to the node the | ||
| 22 | * client continues to be accounted for. Upon file release the usermode | ||
| 23 | * request is removed and a new qos target is computed. This way when the | ||
| 24 | * request that the application has is cleaned up when closes the file | ||
| 25 | * pointer or exits the pm_qos_object will get an opportunity to clean up. | ||
| 26 | * | ||
| 27 | * Mark Gross <mgross@linux.intel.com> | ||
| 28 | */ | ||
| 29 | |||
| 30 | /*#define DEBUG*/ | ||
| 31 | |||
| 32 | #include <linux/pm_qos_params.h> | ||
| 33 | #include <linux/sched.h> | ||
| 34 | #include <linux/spinlock.h> | ||
| 35 | #include <linux/slab.h> | ||
| 36 | #include <linux/time.h> | ||
| 37 | #include <linux/fs.h> | ||
| 38 | #include <linux/device.h> | ||
| 39 | #include <linux/miscdevice.h> | ||
| 40 | #include <linux/string.h> | ||
| 41 | #include <linux/platform_device.h> | ||
| 42 | #include <linux/init.h> | ||
| 43 | #include <linux/kernel.h> | ||
| 44 | |||
| 45 | #include <linux/uaccess.h> | ||
| 46 | |||
| 47 | /* | ||
| 48 | * locking rule: all changes to requests or notifiers lists | ||
| 49 | * or pm_qos_object list and pm_qos_objects need to happen with pm_qos_lock | ||
| 50 | * held, taken with _irqsave. One lock to rule them all | ||
| 51 | */ | ||
| 52 | enum pm_qos_type { | ||
| 53 | PM_QOS_MAX, /* return the largest value */ | ||
| 54 | PM_QOS_MIN /* return the smallest value */ | ||
| 55 | }; | ||
| 56 | |||
| 57 | /* | ||
| 58 | * Note: The lockless read path depends on the CPU accessing | ||
| 59 | * target_value atomically. Atomic access is only guaranteed on all CPU | ||
| 60 | * types linux supports for 32 bit quantites | ||
| 61 | */ | ||
| 62 | struct pm_qos_object { | ||
| 63 | struct plist_head requests; | ||
| 64 | struct blocking_notifier_head *notifiers; | ||
| 65 | struct miscdevice pm_qos_power_miscdev; | ||
| 66 | char *name; | ||
| 67 | s32 target_value; /* Do not change to 64 bit */ | ||
| 68 | s32 default_value; | ||
| 69 | enum pm_qos_type type; | ||
| 70 | }; | ||
| 71 | |||
| 72 | static DEFINE_SPINLOCK(pm_qos_lock); | ||
| 73 | |||
| 74 | static struct pm_qos_object null_pm_qos; | ||
| 75 | static BLOCKING_NOTIFIER_HEAD(cpu_dma_lat_notifier); | ||
| 76 | static struct pm_qos_object cpu_dma_pm_qos = { | ||
| 77 | .requests = PLIST_HEAD_INIT(cpu_dma_pm_qos.requests), | ||
| 78 | .notifiers = &cpu_dma_lat_notifier, | ||
| 79 | .name = "cpu_dma_latency", | ||
| 80 | .target_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE, | ||
| 81 | .default_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE, | ||
| 82 | .type = PM_QOS_MIN, | ||
| 83 | }; | ||
| 84 | |||
| 85 | static BLOCKING_NOTIFIER_HEAD(network_lat_notifier); | ||
| 86 | static struct pm_qos_object network_lat_pm_qos = { | ||
| 87 | .requests = PLIST_HEAD_INIT(network_lat_pm_qos.requests), | ||
| 88 | .notifiers = &network_lat_notifier, | ||
| 89 | .name = "network_latency", | ||
| 90 | .target_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE, | ||
| 91 | .default_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE, | ||
| 92 | .type = PM_QOS_MIN | ||
| 93 | }; | ||
| 94 | |||
| 95 | |||
| 96 | static BLOCKING_NOTIFIER_HEAD(network_throughput_notifier); | ||
| 97 | static struct pm_qos_object network_throughput_pm_qos = { | ||
| 98 | .requests = PLIST_HEAD_INIT(network_throughput_pm_qos.requests), | ||
| 99 | .notifiers = &network_throughput_notifier, | ||
| 100 | .name = "network_throughput", | ||
| 101 | .target_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE, | ||
| 102 | .default_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE, | ||
| 103 | .type = PM_QOS_MAX, | ||
| 104 | }; | ||
| 105 | |||
| 106 | |||
| 107 | static BLOCKING_NOTIFIER_HEAD(min_online_cpus_notifier); | ||
| 108 | static struct pm_qos_object min_online_cpus_pm_qos = { | ||
| 109 | .requests = PLIST_HEAD_INIT(min_online_cpus_pm_qos.requests), | ||
| 110 | .notifiers = &min_online_cpus_notifier, | ||
| 111 | .name = "min_online_cpus", | ||
| 112 | .target_value = PM_QOS_MIN_ONLINE_CPUS_DEFAULT_VALUE, | ||
| 113 | .default_value = PM_QOS_MIN_ONLINE_CPUS_DEFAULT_VALUE, | ||
| 114 | .type = PM_QOS_MAX, | ||
| 115 | }; | ||
| 116 | |||
| 117 | |||
| 118 | static BLOCKING_NOTIFIER_HEAD(max_online_cpus_notifier); | ||
| 119 | static struct pm_qos_object max_online_cpus_pm_qos = { | ||
| 120 | .requests = PLIST_HEAD_INIT(max_online_cpus_pm_qos.requests), | ||
| 121 | .notifiers = &max_online_cpus_notifier, | ||
| 122 | .name = "max_online_cpus", | ||
| 123 | .target_value = PM_QOS_MAX_ONLINE_CPUS_DEFAULT_VALUE, | ||
| 124 | .default_value = PM_QOS_MAX_ONLINE_CPUS_DEFAULT_VALUE, | ||
| 125 | .type = PM_QOS_MIN, | ||
| 126 | }; | ||
| 127 | |||
| 128 | |||
| 129 | static BLOCKING_NOTIFIER_HEAD(cpu_freq_min_notifier); | ||
| 130 | static struct pm_qos_object cpu_freq_min_pm_qos = { | ||
| 131 | .requests = PLIST_HEAD_INIT(cpu_freq_min_pm_qos.requests), | ||
| 132 | .notifiers = &cpu_freq_min_notifier, | ||
| 133 | .name = "cpu_freq_min", | ||
| 134 | .target_value = PM_QOS_CPU_FREQ_MIN_DEFAULT_VALUE, | ||
| 135 | .default_value = PM_QOS_CPU_FREQ_MIN_DEFAULT_VALUE, | ||
| 136 | .type = PM_QOS_MAX, | ||
| 137 | }; | ||
| 138 | |||
| 139 | |||
| 140 | static BLOCKING_NOTIFIER_HEAD(cpu_freq_max_notifier); | ||
| 141 | static struct pm_qos_object cpu_freq_max_pm_qos = { | ||
| 142 | .requests = PLIST_HEAD_INIT(cpu_freq_max_pm_qos.requests), | ||
| 143 | .notifiers = &cpu_freq_max_notifier, | ||
| 144 | .name = "cpu_freq_max", | ||
| 145 | .target_value = PM_QOS_CPU_FREQ_MAX_DEFAULT_VALUE, | ||
| 146 | .default_value = PM_QOS_CPU_FREQ_MAX_DEFAULT_VALUE, | ||
| 147 | .type = PM_QOS_MIN, | ||
| 148 | }; | ||
| 149 | |||
| 150 | |||
| 151 | static struct pm_qos_object *pm_qos_array[] = { | ||
| 152 | &null_pm_qos, | ||
| 153 | &cpu_dma_pm_qos, | ||
| 154 | &network_lat_pm_qos, | ||
| 155 | &network_throughput_pm_qos, | ||
| 156 | &min_online_cpus_pm_qos, | ||
| 157 | &max_online_cpus_pm_qos, | ||
| 158 | &cpu_freq_min_pm_qos, | ||
| 159 | &cpu_freq_max_pm_qos | ||
| 160 | }; | ||
| 161 | |||
| 162 | static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, | ||
| 163 | size_t count, loff_t *f_pos); | ||
| 164 | static ssize_t pm_qos_power_read(struct file *filp, char __user *buf, | ||
| 165 | size_t count, loff_t *f_pos); | ||
| 166 | static int pm_qos_power_open(struct inode *inode, struct file *filp); | ||
| 167 | static int pm_qos_power_release(struct inode *inode, struct file *filp); | ||
| 168 | |||
| 169 | static const struct file_operations pm_qos_power_fops = { | ||
| 170 | .write = pm_qos_power_write, | ||
| 171 | .read = pm_qos_power_read, | ||
| 172 | .open = pm_qos_power_open, | ||
| 173 | .release = pm_qos_power_release, | ||
| 174 | .llseek = noop_llseek, | ||
| 175 | }; | ||
| 176 | |||
| 177 | /* unlocked internal variant */ | ||
| 178 | static inline int pm_qos_get_value(struct pm_qos_object *o) | ||
| 179 | { | ||
| 180 | if (plist_head_empty(&o->requests)) | ||
| 181 | return o->default_value; | ||
| 182 | |||
| 183 | switch (o->type) { | ||
| 184 | case PM_QOS_MIN: | ||
