[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1499650721-5928-8-git-send-email-aubrey.li@intel.com>
Date: Mon, 10 Jul 2017 09:38:37 +0800
From: Aubrey Li <aubrey.li@...el.com>
To: tglx@...utronix.de, peterz@...radead.org, len.brown@...el.com,
rjw@...ysocki.net, ak@...ux.intel.com, tim.c.chen@...ux.intel.com,
arjan@...ux.intel.com, paulmck@...ux.vnet.ibm.com,
yang.zhang.wz@...il.com
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Aubrey Li <aubrey.li@...ux.intel.com>
Subject: [RFC PATCH v1 07/11] cpuidle: make idle residency update more generic
From: Aubrey Li <aubrey.li@...ux.intel.com>
Current cpuidle governor updates the last idle residency with the
hardware c-state exit latency, which is not applicable for fast
idle path, so we update idle residency in idle routine instead.
---
drivers/cpuidle/cpuidle.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 2b7d7bf..97aacab 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -306,8 +306,6 @@ static void cpuidle_update(struct cpuidle_driver *drv,
{
struct cpuidle_governor_stat *gov_stat =
(struct cpuidle_governor_stat *)&(dev->gov_stat);
- int last_idx = gov_stat->last_state_idx;
- struct cpuidle_state *target = &drv->states[last_idx];
unsigned int measured_us;
unsigned int new_factor;
@@ -329,12 +327,6 @@ static void cpuidle_update(struct cpuidle_driver *drv,
/* measured value */
measured_us = cpuidle_get_last_residency(dev);
- /* Deduct exit latency */
- if (measured_us > 2 * target->exit_latency)
- measured_us -= target->exit_latency;
- else
- measured_us /= 2;
-
/* Make sure our coefficients do not exceed unity */
if (measured_us > gov_stat->next_timer_us)
measured_us = gov_stat->next_timer_us;
@@ -481,6 +473,11 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
diff = ktime_us_delta(time_end, time_start);
if (diff > INT_MAX)
diff = INT_MAX;
+ else if (diff > 2 * target_state->exit_latency)
+ /* Deduct exit latency */
+ diff -= target_state->exit_latency;
+ else
+ diff /= 2;
dev->last_residency = (int) diff;
--
2.7.4
Powered by blists - more mailing lists