summaryrefslogtreecommitdiffstats
path: root/include/linux/timer.h
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2010-03-11 14:04:36 -0800
committerThomas Gleixner <tglx@linutronix.de>2010-04-06 21:50:02 +0200
commit3bbb9ec946428b96657126768f65487a48dd090c (patch)
treeb560e8c15102281a110cd5ccd93866084e31014b /include/linux/timer.h
parent3d0205bd1383aa3cac93c209b7c7d03b27930195 (diff)
downloadop-kernel-dev-3bbb9ec946428b96657126768f65487a48dd090c.zip
op-kernel-dev-3bbb9ec946428b96657126768f65487a48dd090c.tar.gz
timers: Introduce the concept of timer slack for legacy timers
While HR timers have had the concept of timer slack for quite some time now, the legacy timers lacked this concept, and had to make do with round_jiffies() and friends. Timer slack is important for power management; grouping timers reduces the number of wakeups which in turn reduces power consumption. This patch introduces timer slack to the legacy timers using the following pieces: * A slack field in the timer struct * An api (set_timer_slack) that callers can use to set explicit timer slack * A default slack of 0.4% of the requested delay for callers that do not set any explicit slack * Rounding code that is part of mod_timer() that tries to group timers around jiffies values every 'power of two' (so quick timers will group around every 2, but longer timers will group around every 4, 8, 16, 32 etc) Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Cc: johnstul@us.ibm.com Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux/timer.h')
-rw-r--r--include/linux/timer.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/timer.h b/include/linux/timer.h
index a2d1eb6..ea965b8 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -10,13 +10,19 @@
struct tvec_base;
struct timer_list {
+ /*
+ * All fields that change during normal runtime grouped to the
+ * same cacheline
+ */
struct list_head entry;
unsigned long expires;
+ struct tvec_base *base;
void (*function)(unsigned long);
unsigned long data;
- struct tvec_base *base;
+ int slack;
+
#ifdef CONFIG_TIMER_STATS
void *start_site;
char start_comm[16];
@@ -165,6 +171,8 @@ extern int mod_timer(struct timer_list *timer, unsigned long expires);
extern int mod_timer_pending(struct timer_list *timer, unsigned long expires);
extern int mod_timer_pinned(struct timer_list *timer, unsigned long expires);
+extern void set_timer_slack(struct timer_list *time, int slack_hz);
+
#define TIMER_NOT_PINNED 0
#define TIMER_PINNED 1
/*
OpenPOWER on IntegriCloud