All of lore.kernel.org
 help / color / mirror / Atom feed
From: venkatesh.pallipadi@intel.com
To: cpufreq@www.linux.org.uk
Cc: davej@redhat.com
Subject: [patch 5/6] cpufreq: Changes to get_cpu_idle_time_us(), to be used in ondemand governor
Date: Thu, 17 Jul 2008 13:55:59 -0700	[thread overview]
Message-ID: <20080717205616.515582000@intel.com> (raw)
In-Reply-To: 20080717205554.214645000@intel.com

[-- Attachment #1: generic_microaccounting_changes.patch --]
[-- Type: text/plain, Size: 1913 bytes --]

export get_cpu_idle_time_us() for it to be used in ondemand governor.
Last update time can be current time when the CPU is currently non-idle,
accounting for the busy time since last idle.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>

---
 include/linux/tick.h     |    2 +-
 kernel/time/tick-sched.c |   11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

Index: linux-2.6/kernel/time/tick-sched.c
===================================================================
--- linux-2.6.orig/kernel/time/tick-sched.c	2008-07-17 13:19:08.000000000 -0700
+++ linux-2.6/kernel/time/tick-sched.c	2008-07-17 13:27:29.000000000 -0700
@@ -20,6 +20,7 @@
 #include <linux/profile.h>
 #include <linux/sched.h>
 #include <linux/tick.h>
+#include <linux/module.h>
 
 #include <asm/irq_regs.h>
 
@@ -184,9 +185,17 @@ u64 get_cpu_idle_time_us(int cpu, u64 *l
 {
 	struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
 
-	*last_update_time = ktime_to_us(ts->idle_lastupdate);
+	if (!tick_nohz_enabled)
+		return -1;
+
+	if (ts->idle_active)
+		*last_update_time = ktime_to_us(ts->idle_lastupdate);
+	else
+		*last_update_time = ktime_to_us(ktime_get());
+
 	return ktime_to_us(ts->idle_sleeptime);
 }
+EXPORT_SYMBOL_GPL(get_cpu_idle_time_us);
 
 /**
  * tick_nohz_stop_sched_tick - stop the idle tick from the idle task
Index: linux-2.6/include/linux/tick.h
===================================================================
--- linux-2.6.orig/include/linux/tick.h	2008-07-17 13:19:08.000000000 -0700
+++ linux-2.6/include/linux/tick.h	2008-07-17 13:27:29.000000000 -0700
@@ -122,7 +122,7 @@ static inline ktime_t tick_nohz_get_slee
 	return len;
 }
 static inline void tick_nohz_stop_idle(int cpu) { }
-static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return 0; }
+static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
 # endif /* !NO_HZ */
 
 #endif

-- 

  parent reply	other threads:[~2008-07-17 20:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-17 20:55 [patch 0/6] cpufreq: Use idle micro-accounting information in ondemand governor venkatesh.pallipadi
2008-07-17 20:55 ` [patch 1/6] cpufreq: Add cpu number parameter to __cpufreq_driver_getavg() venkatesh.pallipadi
2008-07-17 20:55 ` [patch 2/6] cpufreq: Change load calculation in ondemand for software coordination venkatesh.pallipadi
2008-07-17 20:55 ` [patch 3/6] cpufreq: get_cpu_idle_time() changes in ondemand to suit idle-microaccounting venkatesh.pallipadi
2008-07-17 20:55 ` [patch 4/6] cpufreq_ondemand: Parameterize down differential venkatesh.pallipadi
2008-07-17 20:55 ` venkatesh.pallipadi [this message]
2008-07-17 20:56 ` [patch 6/6] cpufreq: Add idle microaccounting in ondemand governor venkatesh.pallipadi
2008-07-30 16:56 ` [patch 0/6] cpufreq: Use idle micro-accounting information " Dave Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080717205616.515582000@intel.com \
    --to=venkatesh.pallipadi@intel.com \
    --cc=cpufreq@www.linux.org.uk \
    --cc=davej@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.