public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [GIT PULL] tracing/workqueue: fix 32 bits unfriendly 64 bits division
@ 2009-04-30 14:54 Frederic Weisbecker
  2009-04-30 15:34 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Frederic Weisbecker @ 2009-04-30 14:54 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: KOSAKI Motohiro, Oleg Nesterov, Andrew Morton, Steven Rostedt,
	Zhao Lei, LKML

Hi Ingo,

Here is a fix for the build error you reported.
This branch can be pulled independantly or on top of tracing/workqueue
from the previous pull-request.

Thanks.


The following changes since commit 10c494ea1b75f96d5fca78178732d79e68129cc0:
  Frederic Weisbecker (1):
        tracing/workqueue: fix 32 bits unfriendly 64 bits division

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git tracing/workqueue-2

---

>From 10c494ea1b75f96d5fca78178732d79e68129cc0 Mon Sep 17 00:00:00 2001
From: Frederic Weisbecker <fweisbec@gmail.com>
Date: Thu, 30 Apr 2009 16:07:59 +0200
Subject: [PATCH] tracing/workqueue: fix 32 bits unfriendly 64 bits division

To get the average of time consumed by each worklets, we do
a direct 64 bits division on wfstat->total_time. This is fine
on a 64 bits arch but not on a 32 one on which we can get the
following warning:

kernel/built-in.o: In function `workqueue_stat_show':
trace_workqueue.c:(.text+0x74f57): undefined reference to `__udivdi3'

We must use do_div() here to ensure the division is supported on
every archs.

[ Impact: fix a build error on 32 bits archs ]

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 kernel/trace/trace_workqueue.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_workqueue.c b/kernel/trace/trace_workqueue.c
index eafb4a5..c67be60 100644
--- a/kernel/trace/trace_workqueue.c
+++ b/kernel/trace/trace_workqueue.c
@@ -399,13 +399,22 @@ static int workqueue_stat_show(struct seq_file *s, void *p)
 	} else {
 		/* It is effect node, need to print workfunc info */
 		int lastwf = list_is_last(&wfstat->list, &cws->workfunclist);
+		unsigned long long avg_time;
+
+		if (wfstat->executed) {
+			avg_time = wfstat->total_time;
+			do_div(avg_time, wfstat->executed);
+			avg_time = ns2usecs(avg_time);
+		} else {
+			avg_time = 0;
+		}
+
 		seq_printf(s, "  %3d   %6d   %6u   %6llu   %6llu   %c-%pF\n",
 			cws->cpu,
 			wfstat->inserted,
 			wfstat->executed,
 			ns2usecs(wfstat->max_executed_time),
-			!wfstat->executed ? 0 :
-				ns2usecs(wfstat->total_time / wfstat->executed),
+			avg_time,
 			lastwf ? '`' : '|',
 			wfstat->func);
 	}
-- 
1.6.2.3



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

* Re: [PATCH] [GIT PULL] tracing/workqueue: fix 32 bits unfriendly 64 bits division
  2009-04-30 14:54 [PATCH] [GIT PULL] tracing/workqueue: fix 32 bits unfriendly 64 bits division Frederic Weisbecker
@ 2009-04-30 15:34 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2009-04-30 15:34 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: KOSAKI Motohiro, Oleg Nesterov, Andrew Morton, Steven Rostedt,
	Zhao Lei, LKML


* Frederic Weisbecker <fweisbec@gmail.com> wrote:

> Hi Ingo,
> 
> Here is a fix for the build error you reported. This branch can be 
> pulled independantly or on top of tracing/workqueue from the 
> previous pull-request.
> 
> Thanks.
> 
> 
> The following changes since commit 10c494ea1b75f96d5fca78178732d79e68129cc0:
>   Frederic Weisbecker (1):
>         tracing/workqueue: fix 32 bits unfriendly 64 bits division
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git tracing/workqueue-2

Thanks, i have pulled this into tip:tracing/workqueues - but that is 
a temporary branch, lets hold off on merging it into tracing/core, 
until some of the more fundamental criticisms of Andrew are 
addressed, ok?

	Ing

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

end of thread, other threads:[~2009-04-30 15:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-30 14:54 [PATCH] [GIT PULL] tracing/workqueue: fix 32 bits unfriendly 64 bits division Frederic Weisbecker
2009-04-30 15:34 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox