mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: discuss@LessWatts.org, lkml <linux-kernel@vger.kernel.org>
Cc: Corey Minyard <minyard@acm.org>,
	openipmi-developer@lists.sourceforge.net,
	Arjan van de Ven <arjan@linux.intel.com>
Subject: [PATCH] ipmi: use round_jiffies on timers to reduce timer overhead/wakeups
Date: Wed, 21 Oct 2009 10:28:22 -0700	[thread overview]
Message-ID: <20091021102822.5b32b2dc.randy.dunlap@oracle.com> (raw)

From: Randy Dunlap <randy.dunlap@oracle.com>

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@oracle.com>
Cc:	Corey Minyard <minyard@acm.org>
Cc:	openipmi-developer@lists.sourceforge.net
---
 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.

             reply	other threads:[~2009-10-21 17:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-21 17:28 Randy Dunlap [this message]
2009-10-21 18:42 ` Arjan van de Ven
2009-10-21 18:49   ` [Discuss] " Kok, Auke
2009-10-21 20:03     ` Randy Dunlap
2009-10-21 20:22       ` Corey Minyard
2009-10-21 20:57         ` Arjan van de Ven
2009-10-22  2:50           ` Matt Domsch
2009-10-22 16:45             ` Corey Minyard
2009-10-22 19:12             ` [Openipmi-developer] [Discuss] [PATCH] " Bela Lubkin
2009-10-22 20:02               ` Corey Minyard
2009-10-22 22:16                 ` Bela Lubkin
2009-10-21 23:46         ` Bela Lubkin

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=20091021102822.5b32b2dc.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=arjan@linux.intel.com \
    --cc=discuss@LessWatts.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minyard@acm.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome