lkml.org 
[lkml]   [2007]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Date
From
Subject[PATCH -rt] cycles_to_usecs rounding fix
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;
}
--
--


\
 
 \ /
  Last update: 2007-12-12 21:31    [W:0.016 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site