[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1799007.TiMX4hfQRk@desktop>
Date: Sun, 25 Oct 2015 06:56:29 +0100
From: "Bendik Rønning Opstad" <bro.devel@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
James Morris <jmorris@...ei.org>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Patrick McHardy <kaber@...sh.net>,
Jonathan Corbet <corbet@....net>,
Eric Dumazet <edumazet@...gle.com>,
Neal Cardwell <ncardwell@...gle.com>,
Tom Herbert <tom@...bertland.com>,
Yuchung Cheng <ycheng@...gle.com>,
Paolo Abeni <pabeni@...hat.com>, Erik Kline <ek@...gle.com>,
Hannes Frederic Sowa <hannes@...essinduktion.org>,
Al Viro <viro@...iv.linux.org.uk>,
Jiri Pirko <jiri@...nulli.us>,
Alexander Duyck <alexander.h.duyck@...hat.com>,
Florian Westphal <fw@...len.de>,
Daniel Lee <Longinus00@...il.com>,
Marcelo Ricardo Leitner <mleitner@...hat.com>,
Daniel Borkmann <daniel@...earbox.net>,
Willem de Bruijn <willemb@...gle.com>,
Linus Lüssing <linus.luessing@...3.blue>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, linux-api@...r.kernel.org,
Andreas Petlund <apetlund@...ula.no>,
Carsten Griwodz <griff@...ula.no>,
Pål Halvorsen <paalh@...ula.no>,
Jonas Markussen <jonassm@....uio.no>,
Kristian Evensen <kristian.evensen@...il.com>,
Kenneth Klette Jonassen <kennetkl@....uio.no>
Subject: Re: [PATCH RFC net-next 1/2] tcp: Add DPIFL thin stream detection mechanism
On Friday, October 23, 2015 02:44:14 PM Eric Dumazet wrote:
> On Fri, 2015-10-23 at 22:50 +0200, Bendik Rønning Opstad wrote:
>
> >
> > +/**
> > + * tcp_stream_is_thin_dpifl() - Tests if the stream is thin based on dynamic PIF
> > + * limit
> > + * @tp: the tcp_sock struct
> > + *
> > + * Return: true if current packets in flight (PIF) count is lower than
> > + * the dynamic PIF limit, else false
> > + */
> > +static inline bool tcp_stream_is_thin_dpifl(const struct tcp_sock *tp)
> > +{
> > + u64 dpif_lim = tp->srtt_us >> 3;
> > + /* Div by is_thin_min_itt_lim, the minimum allowed ITT
> > + * (Inter-transmission time) in usecs.
> > + */
> > + do_div(dpif_lim, tp->thin_dpifl_itt_lower_bound);
> > + return tcp_packets_in_flight(tp) < dpif_lim;
> > +}
> > +
> This is very strange :
>
> You are using a do_div() while both operands are 32bits. A regular
> divide would be ok :
>
> u32 dpif_lim = (tp->srtt_us >> 3) / tp->thin_dpifl_itt_lower_bound;
>
> But then, you can avoid the divide by using a multiply, less expensive :
>
> return (u64)tcp_packets_in_flight(tp) * tp->thin_dpifl_itt_lower_bound <
> (tp->srtt_us >> 3);
>
You are of course correct. Will fix this and use multiply. Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists