codel: use Newton method instead of sqrt() and divides
codel: use Newton method instead of sqrt() and divides

As Van pointed out, interval/sqrt(count) can be implemented using
multiplies only.

http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Iterative_methods_for_reciprocal_square_roots

This patch implements the Newton method and reciprocal divide.

Total cost is 15 cycles instead of 120 on my Corei5 machine (64bit
kernel).

There is a small 'error' for count values < 5, but we don't really care.

I reuse a hole in struct codel_vars :
 - pack the dropping boolean into one bit
 - use 31bit to store the reciprocal value of sqrt(count).

Suggested-by: Van Jacobson <efa44987b6e36a90882a7df93eedc89343acdcb6@pollere.net>
Signed-off-by: Eric Dumazet <312c7d941f03386814be517ffdb3e0eb6624e275@google.com>
Cc: Dave Taht <000d77a82ff9a01d8577d8686173ddf90fc38caa@bufferbloat.net>
Cc: Kathleen Nichols <48f34b8a2501101e599fdb4ef3c9c099d4dde5e3@pollere.com>
Cc: Tom Herbert <0786393240831fc3b5d6ed63658cfb1f3b1e6c40@google.com>
Cc: Matt Mathis <e813780003329e303c800f91fc9cfa0bf40b149a@google.com>
Cc: Yuchung Cheng <5b5a0a360fa35167ac197fe6359c229fde284cf2@google.com>
Cc: Nandita Dukkipati <c885339f99dffe2a5f7eb16e264b2978fb0befe2@google.com>
Cc: Stephen Hemminger <a072e933f45880fe04500ea083d5c7f6e81a06f0@vyatta.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs