[PATCH] ipmi: use round_jiffies on timers to reduce timeroverhead/wakeups
From: Randy Dunlap
Date: Wed Oct 21 2009 - 13:29:24 EST
From: Randy Dunlap <randy.dunlap@xxxxxxxxxx>
Use a round_jiffies() variant to reduce overhead of timer
wakeups. This causes the ipmi timers to occur at the same
time as other timers (per CPU).
Typical powertop for /ipmi/ (2.6.31, before patch):
11.4% (247.4) kipmi0 : __mod_timer (process_timeout)
0.6% ( 13.1) <interrupt> : ipmi_si
0.5% ( 10.0) <kernel core> : __mod_timer (ipmi_timeout)
powertop for /ipmi/, 2.6.31, after patch:
10.8% (247.6) kipmi0 : __mod_timer (process_timeout)
0.3% ( 6.9) <interrupt> : ipmi_si
0.0% ( 1.0) <kernel core> : __mod_timer (ipmi_timeout)
Signed-off-by: Randy Dunlap <randy.dunlap@xxxxxxxxxx>
Cc: Corey Minyard <minyard@xxxxxxx>
Cc: openipmi-developer@xxxxxxxxxxxxxxxxxxxxx
---
drivers/char/ipmi/ipmi_msghandler.c | 7 +++++--
drivers/char/ipmi/ipmi_si_intf.c | 3 ++-
2 files changed, 7 insertions(+), 3 deletions(-)
--- lnx-2632-rc5.orig/drivers/char/ipmi/ipmi_msghandler.c
+++ lnx-2632-rc5/drivers/char/ipmi/ipmi_msghandler.c
@@ -39,6 +39,7 @@
#include <linux/spinlock.h>
#include <linux/mutex.h>
#include <linux/slab.h>
+#include <linux/timer.h>
#include <linux/ipmi.h>
#include <linux/ipmi_smi.h>
#include <linux/notifier.h>
@@ -4057,7 +4058,8 @@ static void ipmi_timeout(unsigned long d
ipmi_timeout_handler(IPMI_TIMEOUT_TIME);
- mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES);
+ mod_timer(&ipmi_timer,
+ round_jiffies_up(jiffies + IPMI_TIMEOUT_JIFFIES));
}
@@ -4424,7 +4426,8 @@ static int ipmi_init_msghandler(void)
#endif /* CONFIG_PROC_FS */
setup_timer(&ipmi_timer, ipmi_timeout, 0);
- mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES);
+ mod_timer(&ipmi_timer,
+ round_jiffies_up(jiffies + IPMI_TIMEOUT_JIFFIES));
atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
--- lnx-2632-rc5.orig/drivers/char/ipmi/ipmi_si_intf.c
+++ lnx-2632-rc5/drivers/char/ipmi/ipmi_si_intf.c
@@ -1068,7 +1068,8 @@ static int smi_start_processing(void
/* Set up the timer that drives the interface. */
setup_timer(&new_smi->si_timer, smi_timeout, (long)new_smi);
new_smi->last_timeout_jiffies = jiffies;
- mod_timer(&new_smi->si_timer, jiffies + SI_TIMEOUT_JIFFIES);
+ mod_timer(&new_smi->si_timer,
+ round_jiffies_up(jiffies + SI_TIMEOUT_JIFFIES));
/*
* Check if the user forcefully enabled the daemon.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/