public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH 1/6] lockstat: fixup signed division
Date: Tue, 23 Sep 2008 15:33:41 +0200	[thread overview]
Message-ID: <20080923133459.116940632@programming.kicks-ass.net> (raw)
In-Reply-To: 20080923133340.929758093@programming.kicks-ass.net

[-- Attachment #1: lockstat-fix-div.patch --]
[-- Type: text/plain, Size: 977 bytes --]

Some recent modification to this code made me notice the little todo mark.
Now that we have more elaborate 64-bit division functions this isn't hard.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 kernel/lockdep_proc.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Index: linux-2.6/kernel/lockdep_proc.c
===================================================================
--- linux-2.6.orig/kernel/lockdep_proc.c
+++ linux-2.6/kernel/lockdep_proc.c
@@ -470,11 +470,12 @@ static void seq_line(struct seq_file *m,
 
 static void snprint_time(char *buf, size_t bufsiz, s64 nr)
 {
-	unsigned long rem;
+	s64 div;
+	s32 rem;
 
 	nr += 5; /* for display rounding */
-	rem = do_div(nr, 1000); /* XXX: do_div_signed */
-	snprintf(buf, bufsiz, "%lld.%02d", (long long)nr, (int)rem/10);
+	div = div_s64_rem(nr, 1000, &rem);
+	snprintf(buf, bufsiz, "%lld.%02d", (long long)div, (int)rem/10);
 }
 
 static void seq_time(struct seq_file *m, s64 time)

-- 


  reply	other threads:[~2008-09-23 13:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-23 13:33 [PATCH 0/6] variuos patches lined up for .28 Peter Zijlstra
2008-09-23 13:33 ` Peter Zijlstra [this message]
2008-09-23 14:18   ` [PATCH 1/6] lockstat: fixup signed division Ingo Molnar
2008-09-23 13:33 ` [PATCH 2/6] sched: fixlet for group load balance Peter Zijlstra
2008-09-23 13:33 ` [PATCH 3/6] sched: add some comments to the bandwidth code Peter Zijlstra
2008-09-23 13:33 ` [PATCH 4/6] sched: more sanity checks on the bandwidth settings Peter Zijlstra
2008-09-23 13:33 ` [PATCH 5/6] sched: fixup buddy selection Peter Zijlstra
2008-09-23 13:33 ` [PATCH 6/6] sched: rework wakeup preemption Peter Zijlstra
2008-09-23 14:23   ` 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=20080923133459.116940632@programming.kicks-ass.net \
    --to=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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