From: David Miller <davem@davemloft.net>
To: eric.dumazet@gmail.com
Cc: dave.taht@bufferbloat.net, nanditad@google.com,
netdev@vger.kernel.org, codel@lists.bufferbloat.net,
ycheng@google.com, shemminger@vyatta.com, mattmathis@google.com
Subject: Re: [Codel] [PATCH net-next] codel: use Newton method instead of sqrt() and divides
Date: Sat, 12 May 2012 15:52:59 -0400 (EDT) [thread overview]
Message-ID: <20120512.155259.1178343836887150194.davem@davemloft.net> (raw)
In-Reply-To: <1336829533.31653.1108.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 12 May 2012 15:32:13 +0200
> From: Eric Dumazet <edumazet@google.com>
>
> 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 <van@pollere.net>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied but I never like that bitfield sharing for real integers.
GCC makes a complete mess of it as it extracts and inserts the
integer value into that bit field. You are guarenteed to get
better code if you do this by hand in a full u32.
Either that or just bite the bullet and use a completely seperate
field, maybe we'll need more boolean states later.
next prev parent reply other threads:[~2012-05-12 19:55 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-12 13:32 Eric Dumazet
2012-05-12 19:52 ` David Miller [this message]
2012-05-12 20:40 ` Eric Dumazet
2012-05-12 20:45 ` David Miller
2012-05-12 21:48 ` Eric Dumazet
2012-05-12 21:52 ` David Miller
2012-05-13 7:23 ` Eric Dumazet
2012-05-14 5:46 ` Andrew McGregor
2012-05-14 6:00 ` dave taht
2012-05-14 6:17 ` Eric Dumazet
2012-05-14 6:33 ` dave taht
2012-05-14 6:47 ` dave taht
2012-05-14 6:51 ` Roger Jørgensen
2012-05-14 8:23 ` Eric Dumazet
2012-05-14 8:50 ` dave taht
2012-05-14 9:03 ` Eric Dumazet
2012-05-14 11:34 ` Roger Jørgensen
2012-05-14 11:56 ` Eric Dumazet
2012-05-14 15:05 ` Dave Taht
2012-05-14 18:31 ` Roger Jørgensen
2012-05-14 22:33 ` David Miller
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
List information: https://lists.bufferbloat.net/postorius/lists/codel.lists.bufferbloat.net/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120512.155259.1178343836887150194.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=codel@lists.bufferbloat.net \
--cc=dave.taht@bufferbloat.net \
--cc=eric.dumazet@gmail.com \
--cc=mattmathis@google.com \
--cc=nanditad@google.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
--cc=ycheng@google.com \
/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