From: Frederic Weisbecker <fweisbec@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Oleg Nesterov <oleg@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Steven Rostedt <rostedt@goodmis.org>,
Zhao Lei <zhaolei@cn.fujitsu.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] [GIT PULL] tracing/workqueue: fix 32 bits unfriendly 64 bits division
Date: Thu, 30 Apr 2009 16:54:26 +0200 [thread overview]
Message-ID: <20090430145425.GA5974@nowhere> (raw)
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
next reply other threads:[~2009-04-30 14:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-30 14:54 Frederic Weisbecker [this message]
2009-04-30 15:34 ` [PATCH] [GIT PULL] tracing/workqueue: fix 32 bits unfriendly 64 bits division Ingo Molnar
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=20090430145425.GA5974@nowhere \
--to=fweisbec@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@redhat.com \
--cc=rostedt@goodmis.org \
--cc=zhaolei@cn.fujitsu.com \
/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