Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1418134 > unrolled thread

[RFC PATCH v2 2/2] power/idle: enhance the precision of sleep_length

Started byzhaoyang.huang@linaro.org
First post2016-06-09 09:40 +0200
Last post2016-06-09 09:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [RFC PATCH v2 2/2] power/idle: enhance the precision of sleep_length zhaoyang.huang@linaro.org - 2016-06-09 09:40 +0200

#1418134 — [RFC PATCH v2 2/2] power/idle: enhance the precision of sleep_length

Fromzhaoyang.huang@linaro.org
Date2016-06-09 09:40 +0200
Subject[RFC PATCH v2 2/2] power/idle: enhance the precision of sleep_length
Message-ID<rI2Jk-3h2-13@gated-at.bofh.it>
From: Zhaoyang Huang <zhaoyang.huang@spreadtrum.com>

There should be a gap between tick_nohz_idle_enter and
tick_nohz_get_sleep_length when idle, which will cause the
sleep_length is not very precised. Change it in this patch.

Signed-off-by: Zhaoyang Huang <zhaoyang.huang@spreadtrum.com>
---
 kernel/time/tick-sched.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 536ada8..ee3be3d 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -975,6 +975,11 @@ void tick_nohz_irq_exit(void)
 ktime_t tick_nohz_get_sleep_length(void)
 {
 	struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched);
+	struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev);
+	ktime_t now;
+
+	now = ktime_get();
+	ts->sleep_length = ktime_sub(dev->next_event, now);
 
 	return ts->sleep_length;
 }
-- 
1.7.9.5

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web