diff options
author | Alex Shi <alex.shi@linaro.org> | 2017-01-12 08:27:04 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-01-30 05:03:32 -0500 |
commit | 9908859acaa95640d4a07991a93f7cd5bfc18e02 (patch) | |
tree | 4606265c8d2ea8ab3cea9c09c2f44aaf3604515c | |
parent | 8e37e1a2a3295f5d99e6dbe99eca24eca7a034ef (diff) |
cpuidle/menu: add per CPU PM QoS resume latency consideration
There may be special requirements on CPU response time, like if a
interrupt is pinned to a CPU, that CPU should not go into excessively
deep idle states. For this reason, add a mechanism for adding
PM QoS resume latency constraints for individual CPUs and modify the
menu governor to take them into account.
To that end, extend the device PM QoS pm_qos_resume_latency attribute
to CPUs, which is possible, because the exit latency for CPUs is
effectively equivalent to the resume latency for devices.
Signed-off-by: Alex Shi <alex.shi@linaro.org>
Acked-by: Rik van Riel <riel@redhat.com>
[ rjw : Subject & changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/cpuidle/governors/menu.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 07e36bb54006..8d6d25c38c02 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/tick.h> | 19 | #include <linux/tick.h> |
20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
21 | #include <linux/math64.h> | 21 | #include <linux/math64.h> |
22 | #include <linux/cpu.h> | ||
22 | 23 | ||
23 | /* | 24 | /* |
24 | * Please note when changing the tuning values: | 25 | * Please note when changing the tuning values: |
@@ -280,17 +281,23 @@ again: | |||
280 | static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | 281 | static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) |
281 | { | 282 | { |
282 | struct menu_device *data = this_cpu_ptr(&menu_devices); | 283 | struct menu_device *data = this_cpu_ptr(&menu_devices); |
284 | struct device *device = get_cpu_device(dev->cpu); | ||
283 | int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); | 285 | int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); |
284 | int i; | 286 | int i; |
285 | unsigned int interactivity_req; | 287 | unsigned int interactivity_req; |
286 | unsigned int expected_interval; | 288 | unsigned int expected_interval; |
287 | unsigned long nr_iowaiters, cpu_load; | 289 | unsigned long nr_iowaiters, cpu_load; |
290 | int resume_latency = dev_pm_qos_read_value(device); | ||
288 | 291 | ||
289 | if (data->needs_update) { | 292 | if (data->needs_update) { |
290 | menu_update(drv, dev); | 293 | menu_update(drv, dev); |
291 | data->needs_update = 0; | 294 | data->needs_update = 0; |
292 | } | 295 | } |
293 | 296 | ||
297 | /* resume_latency is 0 means no restriction */ | ||
298 | if (resume_latency && resume_latency < latency_req) | ||
299 | latency_req = resume_latency; | ||
300 | |||
294 | /* Special case when user has set very strict latency requirement */ | 301 | /* Special case when user has set very strict latency requirement */ |
295 | if (unlikely(latency_req == 0)) | 302 | if (unlikely(latency_req == 0)) |
296 | return 0; | 303 | return 0; |