Since BICTCP_SRTT is a fixed number (0.1 second), we can further
simplify the patch as follows.
First, remove
+#define BICTCP_SRTT ((HZ << 3)/10) /* BIC is now RTT independent */
Next, replace
+ return cubic_root((cube_factor * dist) >> (cube_scale + 3 - BICTCP_HZ));
with
+ return cubic_root(cube_factor * dist);
Finally, replace
+ /* srtt * 2^count / HZ
+ 1) to get a better accuracy of the following d32,
+ the larger the "count", the better the accuracy
+ 2) and avoid overflow of the following d64
+ the larger the "count", the high possibility of overflow
+ 3) so find a "count" between bictcp_hz-3 and bictcp_hz
+ "count" may be less than bictcp_HZ,
+ then d64 becomes 0. that is OK
+ */
+ d32 = BICTCP_SRTT;
+ cube_scale = 0;
+
+ while ( !(d32 & 0x80000000) && (cube_scale < BICTCP_HZ)){
+ d32 = d32 << 1;
+ ++cube_scale;
+ }
+ cube_factor = d64 * d32 / HZ;
with
+ cube_factor = d64 * (1<<BICTCP_HZ) / 10;
[EMAIL PROTECTED] wrote:
---------------------------- Original Message ----------------------------
Subject: Re: [PATCH] cubic: pre-compute based on parameters
From: "David S. Miller" <[EMAIL PROTECTED]>
Date: Mon, December 12, 2005 5:57 pm
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
netdev@vger.kernel.org
--------------------------------------------------------------------------
From: Stephen Hemminger <[EMAIL PROTECTED]>
Date: Mon, 12 Dec 2005 12:03:22 -0800
- d32 = d32 / HZ;
-
/* (wmax-cwnd) * (srtt>>3 / HZ) / c * 2^(3*bictcp_HZ) */
- d64 = (d64 * dist * d32) >> (count+3-BICTCP_HZ);
-
- /* cubic root */
- d64 = cubic_root(d64);
-
- result = (u32)d64;
- return result;
+ return cubic_root((cube_factor * dist) >> (cube_scale + 3 - BICTCP_HZ));
...
+ while ( !(d32 & 0x80000000) && (cube_scale < BICTCP_HZ)){
+ d32 = d32 << 1;
+ ++cube_scale;
+ }
+ cube_factor = d64 * d32 / HZ;
+
I don't think this transformation is equivalent.
In the old code only the "d32" is scaled by HZ.
So in the old code we're saying something like:
d64 = (d64 * dist * (d32 / HZ)) >> (count + 3 - BICTCP_HZ);
whereas the new code looks like:
d64 = (((d64 * d32) / HZ) * dist) >> (count + 3 - BICTCP_HZ);
Is that really equivalent?
--
Lisong Xu Tel : (402)472-1053
Assistant Professor Fax : (402)472-7767
Computer Science & Engineering mail: [EMAIL PROTECTED]
University of Nebraska-Lincoln http://cse.unl.edu/~xu
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html