Patchwork raltelimit bug

login
register
mail settings
Submitter Dietmar Maurer
Date Oct. 24, 2012, 8:56 a.m.
Message ID <24E144B8C0207547AD09C467A8259F75576FED43@lisa.maurer-it.com>
Download mbox | patch
Permalink /patch/194009/
State New
Headers show

Comments

Dietmar Maurer - Oct. 24, 2012, 8:56 a.m.
The code to compute slice_quota seems buggy. The following fixes the issue:
Eric Blake - Oct. 24, 2012, 11:24 p.m.
On 10/24/2012 02:56 AM, Dietmar Maurer wrote:
> The code to compute slice_quota seems buggy. The following fixes the issue:
> 
> --- new.orig/include/qemu/ratelimit.h   2012-10-22 07:06:31.000000000 +0200

Missing a Signed-off-By, so it cannot be taken as-is.  See
http://wiki.qemu.org/Contribute/SubmitAPatch for hints.

> +++ new/include/qemu/ratelimit.h        2012-10-22 07:06:49.000000000 +0200
> @@ -42,7 +42,7 @@
>                                         uint64_t slice_ns)
>  {
>      limit->slice_ns = slice_ns;
> -    limit->slice_quota = ((double)speed * 1000000000ULL) / slice_ns;
> +    limit->slice_quota = ((double)speed * slice_ns)/1000000000ULL;
>  }
>  
>  #endif
> 
> 
> 
>

Patch

--- new.orig/include/qemu/ratelimit.h   2012-10-22 07:06:31.000000000 +0200
+++ new/include/qemu/ratelimit.h        2012-10-22 07:06:49.000000000 +0200
@@ -42,7 +42,7 @@ 
                                        uint64_t slice_ns)
 {
     limit->slice_ns = slice_ns;
-    limit->slice_quota = ((double)speed * 1000000000ULL) / slice_ns;
+    limit->slice_quota = ((double)speed * slice_ns)/1000000000ULL;
 }
 
 #endif