LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Timer cleanups
@ 2008-02-04 23:48 Pavel Machek
  2008-02-17 16:38 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Machek @ 2008-02-04 23:48 UTC (permalink / raw)
  To: kernel list, Ingo Molnar


Add anotations, so that timertop produces nicer results. Relative
expiry time can get negative, so it should be signed.

Signed-off-by: Pavel Machek <Pavel@suse.cz>


diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 429d084..235fd6c 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -368,8 +368,8 @@ static int hpet_clocksource_register(voi
 	return 0;
 }
 
-/*
- * Try to setup the HPET timer
+/**
+ * hpet_enable - Try to setup the HPET timer. Returns 1 on success.
  */
 int __init hpet_enable(void)
 {
diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
index d3d94c1..0fab3ca 100644
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
@@ -65,9 +65,9 @@ #ifdef CONFIG_TIMER_STATS
 	SEQ_printf(m, ", %s/%d", tmp, timer->start_pid);
 #endif
 	SEQ_printf(m, "\n");
-	SEQ_printf(m, " # expires at %Lu nsecs [in %Lu nsecs]\n",
+	SEQ_printf(m, " # expires at %Lu nsecs [in %Ld nsecs]\n",
 		(unsigned long long)ktime_to_ns(timer->expires),
-		(unsigned long long)(ktime_to_ns(timer->expires) - now));
+		(long long)(ktime_to_ns(timer->expires) - now));
 }
 
 static void
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 52db48e..6cbec10 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -219,6 +219,7 @@ int queue_delayed_work_on(int cpu, struc
 	struct timer_list *timer = &dwork->timer;
 	struct work_struct *work = &dwork->work;
 
+	timer_stats_timer_set_start_info(&dwork->timer);
 	if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) {
 		BUG_ON(timer_pending(timer));
 		BUG_ON(!list_empty(&work->entry));
@@ -580,6 +581,7 @@ EXPORT_SYMBOL(schedule_delayed_work);
 int schedule_delayed_work_on(int cpu,
 			struct delayed_work *dwork, unsigned long delay)
 {
+	timer_stats_timer_set_start_info(&dwork->timer);
 	return queue_delayed_work_on(cpu, keventd_wq, dwork, delay);
 }
 EXPORT_SYMBOL(schedule_delayed_work_on);

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Timer cleanups
  2008-02-04 23:48 Timer cleanups Pavel Machek
@ 2008-02-17 16:38 ` Thomas Gleixner
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2008-02-17 16:38 UTC (permalink / raw)
  To: Pavel Machek; +Cc: kernel list, Ingo Molnar

On Tue, 5 Feb 2008, Pavel Machek wrote:
> 
> Add anotations, so that timertop produces nicer results. Relative
> expiry time can get negative, so it should be signed.
> 
> Signed-off-by: Pavel Machek <Pavel@suse.cz>

Please do not mix patches for arch / generic code 

> diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
> index 429d084..235fd6c 100644
> --- a/arch/x86/kernel/hpet.c
> +++ b/arch/x86/kernel/hpet.c
> @@ -368,8 +368,8 @@ static int hpet_clocksource_register(voi
>  	return 0;
>  }
>  
> -/*
> - * Try to setup the HPET timer
> +/**
> + * hpet_enable - Try to setup the HPET timer. Returns 1 on success.
>   */
>  int __init hpet_enable(void)
>  {

Applied to x86.

> diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
> index d3d94c1..0fab3ca 100644
> --- a/kernel/time/timer_list.c
> +++ b/kernel/time/timer_list.c
> @@ -65,9 +65,9 @@ #ifdef CONFIG_TIMER_STATS
>  	SEQ_printf(m, ", %s/%d", tmp, timer->start_pid);
>  #endif
>  	SEQ_printf(m, "\n");
> -	SEQ_printf(m, " # expires at %Lu nsecs [in %Lu nsecs]\n",
> +	SEQ_printf(m, " # expires at %Lu nsecs [in %Ld nsecs]\n",
>  		(unsigned long long)ktime_to_ns(timer->expires),
> -		(unsigned long long)(ktime_to_ns(timer->expires) - now));
> +		(long long)(ktime_to_ns(timer->expires) - now));
>  }

Applied to -hrt.

>  static void
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 52db48e..6cbec10 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -219,6 +219,7 @@ int queue_delayed_work_on(int cpu, struc
>  	struct timer_list *timer = &dwork->timer;
>  	struct work_struct *work = &dwork->work;
>  
> +	timer_stats_timer_set_start_info(&dwork->timer);
>  	if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) {
>  		BUG_ON(timer_pending(timer));
>  		BUG_ON(!list_empty(&work->entry));
> @@ -580,6 +581,7 @@ EXPORT_SYMBOL(schedule_delayed_work);
>  int schedule_delayed_work_on(int cpu,
>  			struct delayed_work *dwork, unsigned long delay)
>  {
> +	timer_stats_timer_set_start_info(&dwork->timer);
>  	return queue_delayed_work_on(cpu, keventd_wq, dwork, delay);
>  }
>  EXPORT_SYMBOL(schedule_delayed_work_on);

Makes sense to see the call site of schedule_delayed_work in the
stats. Applied to hrt.

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-17 16:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-04 23:48 Timer cleanups Pavel Machek
2008-02-17 16:38 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).