summaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle
diff options
context:
space:
mode:
authorRamesh Thomas <ramesh.thomas@intel.com>2017-10-26 22:01:34 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-11-08 06:16:01 -0500
commitc523c68da2117a3f9f777110839b1cf7ed7221be (patch)
tree2b06b4593e6af9d9614fc8a4c4c1d41f88eb1144 /drivers/cpuidle
parent4e37fd4d5dfd39f547b0b00fa184a440a1e44b96 (diff)
cpuidle: ladder: Add per CPU PM QoS resume latency support
Individual CPUs may have special requirements to not enter deep idle states. For example, a CPU running real time applications would not want to enter deep idle states to avoid latency impacts. At the same time other CPUs that do not have such a requirement could allow deep idle states to save power. This was already implemented in the menu governor. Implementing similar changes in the ladder governor which gets selected when CONFIG_NO_HZ and CONFIG_NO_HZ_IDLE are not set. Refer following commits for the menu governor changes. Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpuidle')
-rw-r--r--drivers/cpuidle/governors/ladder.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c
index ce1a2ffffb2a..1ad8745fd6d6 100644
--- a/drivers/cpuidle/governors/ladder.c
+++ b/drivers/cpuidle/governors/ladder.c
@@ -17,6 +17,7 @@
17#include <linux/pm_qos.h> 17#include <linux/pm_qos.h>
18#include <linux/jiffies.h> 18#include <linux/jiffies.h>
19#include <linux/tick.h> 19#include <linux/tick.h>
20#include <linux/cpu.h>
20 21
21#include <asm/io.h> 22#include <asm/io.h>
22#include <linux/uaccess.h> 23#include <linux/uaccess.h>
@@ -67,10 +68,16 @@ static int ladder_select_state(struct cpuidle_driver *drv,
67 struct cpuidle_device *dev) 68 struct cpuidle_device *dev)
68{ 69{
69 struct ladder_device *ldev = this_cpu_ptr(&ladder_devices); 70 struct ladder_device *ldev = this_cpu_ptr(&ladder_devices);
71 struct device *device = get_cpu_device(dev->cpu);
70 struct ladder_device_state *last_state; 72 struct ladder_device_state *last_state;
71 int last_residency, last_idx = ldev->last_state_idx; 73 int last_residency, last_idx = ldev->last_state_idx;
72 int first_idx = drv->states[0].flags & CPUIDLE_FLAG_POLLING ? 1 : 0; 74 int first_idx = drv->states[0].flags & CPUIDLE_FLAG_POLLING ? 1 : 0;
73 int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); 75 int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
76 int resume_latency = dev_pm_qos_raw_read_value(device);
77
78 if (resume_latency < latency_req &&
79 resume_latency != PM_QOS_RESUME_LATENCY_NO_CONSTRAINT)
80 latency_req = resume_latency;
74 81
75 /* Special case when user has set very strict latency requirement */ 82 /* Special case when user has set very strict latency requirement */
76 if (unlikely(latency_req == 0)) { 83 if (unlikely(latency_req == 0)) {