Deferrable timers

Scott Lamb slamb at slamb.org
Fri Jul 27 19:45:35 PDT 2007


First, thanks for the great tool.

I noticed that deferrable timers are now flagged by the kernel with a
'D' at the end of the count. My understanding is that deferrable timers
 don't run until the next non-deferrable timer is scheduled. Is that
correct?

If so, I believe PowerTOP shouldn't show them in its blamelist, as they
do not cause wakeups. I've attached a patch to this effect. I tried to
future-proof it against other flags being added.

Here's the kernel change:

commit c5c061b8f9726bc2c25e19dec227933a13d1e6b7
Author: Venki Pallipadi <venkatesh.pallipadi at intel.com>
Date:   Sun Jul 15 23:40:30 2007 -0700

    Add a flag to indicate deferrable timers in /proc/timer_stats

    Add a flag in /proc/timer_stats to indicate deferrable timers.  This
will
    let developers/users to differentiate between types of tiemrs in
    /proc/timer_stats.

    Deferrable timer and normal timer will appear in /proc/timer_stats
as below.
      10D,     1 swapper          queue_delayed_work_on
(delayed_work_timer_fn)
       10,     1 swapper          queue_delayed_work_on
(delayed_work_timer_fn)

    Also version of timer_stats changes from v0.1 to v0.2

    Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi at intel.com>
    Acked-by: Ingo Molnar <mingo at elte.hu>
    Cc: Thomas Gleixner <tglx at linutronix.de>
    Cc: john stultz <johnstul at us.ibm.com>
    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>

Best regards,
Scott

-- 
Scott Lamb <http://www.slamb.org/>
-------------- next part --------------
Silence deferrable timers in the timer_stats display when run against
a recent kernel version. The kernel change, below, was first released in
Linux v2.6.22.

commit c5c061b8f9726bc2c25e19dec227933a13d1e6b7
Author: Venki Pallipadi <venkatesh.pallipadi at intel.com>
Date:   Sun Jul 15 23:40:30 2007 -0700

    Add a flag to indicate deferrable timers in /proc/timer_stats
    
    Add a flag in /proc/timer_stats to indicate deferrable timers.  This will
    let developers/users to differentiate between types of tiemrs in
    /proc/timer_stats.
    
    Deferrable timer and normal timer will appear in /proc/timer_stats as below.
      10D,     1 swapper          queue_delayed_work_on (delayed_work_timer_fn)
       10,     1 swapper          queue_delayed_work_on (delayed_work_timer_fn)
    
    Also version of timer_stats changes from v0.1 to v0.2
    
    Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi at intel.com>
    Acked-by: Ingo Molnar <mingo at elte.hu>
    Cc: Thomas Gleixner <tglx at linutronix.de>
    Cc: john stultz <johnstul at us.ibm.com>
    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>



Index: powertop.c
===================================================================
--- powertop.c	(revision 232)
+++ powertop.c	(working copy)
@@ -499,6 +499,7 @@
 			char *count, *pid, *process, *func;
 			char line2[1024];
 			int cnt;
+			int deferrable = 0;
 			memset(line, 0, 1024);
 			if (fgets(line, 1024, file) == NULL)
 				break;
@@ -544,7 +545,13 @@
 				continue;
 			if (c)
 				*c = 0;
-			cnt = strtoull(count, NULL, 10);
+			cnt = strtoull(count, &c, 10);
+			while (*c != 0) {
+				if (*c++ == 'D')
+					deferrable = 1;
+			}
+			if (deferrable)
+				continue;
 			sprintf(line2, "%15s : %s", process, func);
 			push_line(line2, cnt);
 		}


More information about the Power mailing list