From: Daniel Walker <dwalker@mvista.com>
To: rostedt@goodmis.org
Cc: mingo@elte.hu, linux-kernel@vger.kernel.org,
linux-rt-users@vger.kernel.org, johnstul@us.ibm.com
Subject: [PATCH -rt] cycles_to_usecs rounding fix
Date: Wed, 12 Dec 2007 12:15:22 -0800
Date: Wed, 12 Dec 2007 12:12:58 -0800 [thread overview]
Message-ID: <20071212201522.061896981@mvista.com> (raw)
Message-ID: <20071212201258.890003246@mvista.com> (raw)
do_div() rounds down, so we add have the divisor to round up. This effected my
change to preempt_max_latency. Each time you read preempt_max_latency it gets
rounded lower.
Signed-off-by: Daniel Walker <dwalker@mvista.com>
---
kernel/time/timekeeping.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: linux-2.6.23/kernel/time/timekeeping.c
===================================================================
--- linux-2.6.23.orig/kernel/time/timekeeping.c
+++ linux-2.6.23/kernel/time/timekeeping.c
@@ -144,7 +144,8 @@ unsigned long notrace cycles_to_usecs(cy
{
u64 ret = cyc2ns(clock, cycles);
- do_div(ret, 1000);
+ ret += NSEC_PER_USEC/2; /* For rounding in do_div() */
+ do_div(ret, NSEC_PER_USEC);
return ret;
}
--
--
reply other threads:[~2007-12-12 20:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20071212201522.061896981@mvista.com \
--to=dwalker@mvista.com \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
/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